Live data from Hacker News

Why is JSON so popular? Developers want out of the syntax business

blog.mongolab.com

1–10 of 133 posts

Re: Why is JSON so popular? Developers want out of the syntax business

#3
The problem with XML is that it seemed to encourage more complicated data structures. People sort of forgot that you still have to process all this data. And that, at the end of the day, a lot of it ends up needing to be represented in columns and rows.

Re: Why is JSON so popular? Developers want out of the syntax business

#4
The post actually appears to endorse using eval to parse JSON. Not only does that allow invalid JSON through, it disallows some valid JSON, and of course is a huge security hole.

If you want to handle JSON data in JavaScript use JSON.parse -- it's the safest, fastest, and most correct path to having your data available to you.

[update: edited to remove bizarre use of whole vs hole... boggles]

Re: Why is JSON so popular? Developers want out of the syntax business

#8
post #7

Ironically, php provides a way to access XML data almost as easily as JASON data - SimpleXML. Do other languages/frameworks really have nothing similar?

While SimpleXML gives you an easy way to walk the tree, it still requires you to actually do it. All 3 of those examples would require slightly different calls to SimpleXML to handle.

Re: Why is JSON so popular? Developers want out of the syntax business

#9
post #4

The post actually appears to endorse using eval to parse JSON. Not only does that allow invalid JSON through, it disallows some valid JSON, and of course is a huge security hole. If you want to handle JSON data in JavaScript use JSON.parse -- it's the safest, fastest, and most correct path to having your data available to you. [update: edited to remove bizarre use of whole vs hole... boggles ]

Yes! I was shocked to see him recommend the use of a straight eval for parsing JSON.

json2.js is a must! JSON.parse and JSON.stringify are your friends.

https://github.com/douglascrockford/JSON-js/blob/master/json...

Post reply on HN