0
I have this json and would like to know how to convert it to an arrag/string
{'texto_mensagem': {'texto': 'Mensagem de envio'}, 'numero_celular': [{'numero': '5537988440956'}, {'numero': '5537988530808'}, {'numero': '5537988555533'}]}
My client is this
$(function() {
$.ajax({
type: "post",
data: "{'texto_mensagem': {'texto': 'Mensagem de envio'}, 'numero_celular': [{'numero': '5537988440956'}, {'numero': '5537988530808'}, {'numero': '5537988555533'}]}",
contentType: "application/json; charset=UTF-8; charset=utf-8",
dataType: "json",
url: 'http://www.e-sms.com.br/api',
success: function(data){
console.log(data);
},
error: function (request){
console.log(request);
}
});
});
json_decode()
that would be it?– rray
No, Contenttype: "application/json"
– willian rodrigues andrade
json_decode($request->getBody(), true) returns NULL
– willian rodrigues andrade
Maybe the json are valid, see: Is there any way to find an error occurred in json_decode?
– rray
Creoq u does not apply friend; Json is valid. But says that syntax is incorrect.
– willian rodrigues andrade
the point is I’m not sending an atring json but a json.
– willian rodrigues andrade
Your problem is in the right php? could the code?
– rray
http://pastebin.com/Tqc4jXpa
– willian rodrigues andrade
Let’s go continue this discussion in chat.
– willian rodrigues andrade