In my app I have controller which perform several operation on request received as JSON, but sometimes I receive request as x-www-form-urlencoded. I would like to convert it to JSON at begining of controller action.
For example I would like to convert:
%7B%0A++%22action%22=%22new_pet%22%2C&%22content%22=%7B&%220%22=%7B&%22name%22=%22Amigo%22%2C&%22sex%22=%22male%22%2C&%22owner%22=%227449903%22%2C&%22type%22=%22dog%22&%7D%0A++%7D%2C%0A++%22controller%22=%22animal%22
to:
{
"action": "new_pet",
"content": {
"0": {
"name": "Amigo",
"sex": "male",
"owner": "7449903",
"type": "dog"
}
},
"controller": "animal"
}
Aucun commentaire:
Enregistrer un commentaire