Published by nick on 24 Apr 2009 at 09:35 am
Why on earth doesn’t javascript have a json_encode?!
Every major language now has tools for JSON encoding a string of text, which is a format that is natively read, understand, and used by Javascript. PHP’s json_encode works great, I use it all the time for data transport. The reasons for using XML are getting harder and harder to come by. JSON is much easier to work with.
Every major language has a built in json_encode, except, Javascript!
WTF? Irony at it’s best.
I’m using Douglas Crockford’s JSON.js in the meantime, but Firefox, Internet Explorer, Safari developers - please include support for this in a future release.
Update Jun 29 2009: I was listened too.
Firefox 3.1+ and IE 8+ now have native JSON support. More info
David Tabachnikov on 26 Apr 2009 at 4:02 am #
Actually, Firefox 3 and 3.5 have built-in support for JavaScript encoding and decoding, with much better support coming in 3.5.
https://developer.mozilla.org/en/JSON#JSON_in_Firefox_3
JSON decoding and encoding is also defined as part of EcmaScript 3.1:
http://wiki.ecmascript.org/doku.php?id=es3.1:json_support