there a tons of tutorials on the web about how to set the action-response to type json in a symfony controller. But how can I receive JSON?
$request->getRequestFormat() returns "json", but the json data seems to be lost, because $request->getParameter() doesn't work.
This is my routing:
importservice:
url: /importservice
class: sfRequestRoute
param: { module: remoteaccess, action: import, sf_format: json }
requirements:
sf_method: post
sf_format: json
Edit:
getParameter() decodes multipart/form-data (html-forms) and get-parameters, so I thought it also does this for content-type application/json. I need this for a web-service which posts data. My basic idea was that it makes no difference whether a human fills out html-forms or a bot sends the data directly. I thought that encoding the content to json is easier to implement than encoding it to multipart/form-data.