NYCPHP Meetup

[nycphp-talk] What json library do you use?

Cliff Hirsch cliff at pinestream.com
Wed Aug 8 11:52:29 EDT 2007


On 8/8/07 11:00 AM, "Cliff Hirsch" <cliff at pinestream.com> wrote:
Json will be standard from php5.2 onwards. But for those of us that are a
bit behind, what json library do you recommend for development, knowing that
it will be phased out as we switch to the native php5.2 json extension?
> 
> Best regards,
> Cliff Hirsch

Just answered my own question. Installing the json pecl extension (which is
what¹s used in PHP5.2+) is trivial. It¹s in xampp or avail as a dll
elsewhere, and you just need to add the extension to your php.ini file.

Test:
$arr = array('dog'=>1,2,3=>array(1,2,3));
echo '{"sample":'.json_encode($arr).'}';

Result:
"sample":{"dog":1,"0":2,"3":[1,2,3]}}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070808/0cadd36c/attachment.html>


More information about the talk mailing list