how to use JSON.stringify and json_decode() properly
You'll need to check the contents of $_POST["JSONfullInfoArray"]
. If something doesn't parse json_decode
will just return null
. This isn't very helpful so when null
is returned you should check json_last_error()
to get more info on what went wrong.
When you use JSON stringify then use html_entity_decode first before json_decode.
$tempData = html_entity_decode($tempData);
$cleanData = json_decode($tempData);
When you save some data using JSON.stringify() and then need to read that in php. The following code worked for me.
json_decode( html_entity_decode( stripslashes ($jsonString ) ) );
Thanks to @Thisguyhastwothumbs