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" <[EMAIL PROTECTED]> 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

_______________________________________________
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

Reply via email to