NYCPHP Meetup

NYPHP.org

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

Jon Baer jonbaer at jonbaer.com
Wed Aug 8 14:09:56 EDT 2007


What even a little more confusing is that a full package is already  
in the Zend Framework ...

http://framework.zend.com/manual/en/zend.json.html

$json = Zend_Json::encode($phpNative);
$phpNative = Zend_Json::decode($encodedValue, Zend_Json::TYPE_OBJECT);

- Jon

On Aug 8, 2007, at 11:52 AM, Cliff Hirsch wrote:

> 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]}}
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070808/23f21de4/attachment.html>


More information about the talk mailing list