Json and php settings
I am passing json encoded string from javascript to php file on server via ajax. on my online server this works fine. but locally it is not.
There are some differences in php settings in 2 places. minor. both are php4. the local install is actually new php4.
I am trying to figure out why this is happening. Seems like server side json parsing with pear servies_json (json.php) is not being handled correctly. It manages the first brackets but then it stops there and all internal data is lost?
Is there a php plugin or something I need to install to prevent this from happening. Tuning switch? Thanks for any help.
json_decode () should be used server side to decode a JSON object, it should work pretty consistently. Its sister function json_encode () is equally good for encoding an array / object for a JSON string that can echo in your javascript.
Both functions require php 5, for php 4 you can check this code .
a source to share