JSON.php array size 0/1

If you are experiencing issues using a 3rd party JSON php parser, and your objects are null or your array sizes keep coming back as zero, try this line in php (this is for JSON.php created by @copyright 2005 Michal Migurski) only:

$my_data = str_replace('\\"', '"', $my_data);

$json = new Services_JSON();$json->decode($my_data);

This is due to the JSON parser unable to interpret escaped quotes.  This is an excellent encoder and decoder, but this issue caused a few days of grief.

This code is for a legacy system with an outdated version of PHP.  Newer versions of PHP should have support for JSON decoding and JSON encoding.

-Tres

Comments

Popular posts from this blog

Dell Zino HD Remote Standard

iPod Touch iPhone 3G Ubuntu 9.10 in 5 minutes

Pidgin - Microsoft Office Communicator