I am trying to pass JSON object from angular to php like this :
<?php
$placeBean = "{{masterCtrl.getLastplace();}}";
//VAR DUMP IS -> string(30) "{"id":1841,"name":"Milano","areaCode":"MI","latitude":0,"longitude":0}"
$json = '{"id":1841,"name":"Milano","areaCode":"MI","latitude":0,"longitude":0}';
//VAR DUMP IS -> string(70) "{"id":1841,"name":"Milano","areaCode":"MI","latitude":0,"longitude":0}"
?>
Then I need to parse the json in $placeBean, because it is not yet a json in php, so I use
<?php
$manage = json_decode($placeBean);
?>
And this is the problem... because it doesn't work, in fact the result is an empty value: instead, if I do the same thing with $json( instead of $placeBean), the code works perfectly. I Think the issue is some missing chars, which are placed in$json, and not in $placeBean.
Those are the echo of the variables
ECHO OF JSON ->{"id":1841,"name":"Milano","areaCode":"MI","latitude":0,"longitude":0}
ECHO OF placeBean -> placeBean{"id":1841,"name":"Milano","areaCode":"MI","latitude":0,"longitude":0}
I Also tried to use json_last_error, which gave me this : - Syntax error, malformed
echo $placeBean;andecho $json;after those two lines you show at the start of your question?