NYCPHP Meetup

NYPHP.org

[nycphp-talk] Anybody using JSON parser?

Allen Shaw ashaw at polymerdb.org
Fri Apr 13 17:28:01 EDT 2007


Kenneth Downs wrote:
> Andromeda uses its own syntax for data files, which I would love to get 
> rid of.
> 
> JSON strikes me as a worthy candidate.  Is anybody using it on the 
> server-side with enough confidence to answer this question:  Can I type 
> a file of JSON stuff by hand and convert it easily into a nested 
> associative array?

I use JSON in slidePresenter for transferring nested arrays between PHP 
and JavaScript.  It works so well I pretty much just forget about it.

The parser I'm using is this file: 
http://mike.teczno.com/JSON/JSON.phps, which is a part of the PEAR 
proposal for JSON 
(<http://pear.php.net/pepr/pepr-proposal-show.php?id=198>).

For converting PHP associative arrays into JSON format this has been 
very good, and I've not seen any limit to the levels to which the arrays 
can be nested.

See around line 94 in the source file for a quick howto.

- Allen

-- 
Allen Shaw
Polymer (http://polymerdb.org)
slidePresenter (http://slides.sourceforge.net)



More information about the talk mailing list