Live data from Hacker News

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

blog.mongolab.com

101–110 of 133 posts

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

#101

The best way I've encountered to construct XML: first-name John last-name Smith I kid you not. That's what I'm dealing with at work right now. Thank you, enterprise SOAP solutions.

If that is the worst XML that you have experienced then you have been very very lucky. I've seen stuff that: - Has been built by string manipulation and therefore isn't well formed and needs hacky preprocessing before being parsed (no not HTML) - Is full of redundant information (e.g. count attributes giving the number of child elements) - Makes evil use of vast numbers of namespaces where the element names are all t…

> - Had attributes that contained entire encoded XML documents

I've got that beat. I've dealt with XML that was basically a wrapper for JSON, which contained - you know where this is going - an XML string.

It's retarded elephants all the way down.

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

#102

Earlier quoted context omitted.

If that is the worst XML that you have experienced then you have been very very lucky. I've seen stuff that: - Has been built by string manipulation and therefore isn't well formed and needs hacky preprocessing before being parsed (no not HTML) - Is full of redundant information (e.g. count attributes giving the number of child elements) - Makes evil use of vast numbers of namespaces where the element names are all t…

> - Had attributes that contained entire encoded XML documents I've got that beat. I've dealt with XML that was basically a wrapper for JSON, which contained - you know where this is going - an XML string. It's retarded elephants all the way down.

This is getting downright Yorkshiremenesque.

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

#103

Earlier quoted context omitted.

If that is the worst XML that you have experienced then you have been very very lucky. I've seen stuff that: - Has been built by string manipulation and therefore isn't well formed and needs hacky preprocessing before being parsed (no not HTML) - Is full of redundant information (e.g. count attributes giving the number of child elements) - Makes evil use of vast numbers of namespaces where the element names are all t…

> - Had attributes that contained entire encoded XML documents I've got that beat. I've dealt with XML that was basically a wrapper for JSON, which contained - you know where this is going - an XML string. It's retarded elephants all the way down.

Notice the "encoded" - they were (if I recall correctly) base64 encoded XML documents...

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

#104

Earlier quoted context omitted.

> - Had attributes that contained entire encoded XML documents I've got that beat. I've dealt with XML that was basically a wrapper for JSON, which contained - you know where this is going - an XML string. It's retarded elephants all the way down.

This is getting downright Yorkshiremenesque.

Had to look that one up before dispensing an upvote.

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

#105
One problem I have with JSON is that there is no canonical way to represent union types. For example, if you have the Haskell type

  data C = A { field1 :: T1, field2 :: T2 } | B { field3 :: T3 }
How do you represent this in JSON? The contents of the 'A' or 'B' constructor are easy:

  { field1: value1, field2: value2 }
But how do you indicate which constructor it is? I can come up with a couple less than ideal ways. Which one do others use?

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

#106
post #73

Earlier quoted context omitted.

I haven't been able to find any solid, broad implementations of anything that brings schemas to json - either this ietf standard or something else. Only some half-assed and not developed for years implementations for a single programming language. Are there implementation of the spec you link to?

It's not JSON-schema, but Rx is a schema validation tool for JSON/YAML/etc. that works with many languages: http://rx.codesimply.com/

Yes, this is one of the half-assed, half-dead efforts I was referring to. Last commit Jan 2010, and even that one touched only some files, previous commits are all from 2008. It only supports a few languages - no C++, no Java, no .Net. The website itself says on the first page "relying on any implementation in production would be a bad idea". Plus, Rx doesn't offer the same functionality XML Schema does, from what I can find (only does type checking, no element order/count, default values etc).

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

#108
post #33

The best way I've encountered to construct XML: first-name John last-name Smith I kid you not. That's what I'm dealing with at work right now. Thank you, enterprise SOAP solutions.

I've worked with worse: John Smith 123 Some Street Blah Blah Blah ... and so on. I can't think of any advantage to (or excuse for) doing it this way. The only possible reason for it that I can think of, is rather comprehensive ignorance of how XML and related standards work.

I have to work with MB's of this type of XML. It forces the use of special XML tools to even make is readable.

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

#109

Earlier quoted context omitted.

That because schemas are complicated, no matter which way you encode the data. JSON is so nice and easy and simple until it needs all those things that made it into XML to get the job done. I whole heartedly agree, there is nothing sweeter than giving another vendor our WSDL with schema when they ask how to work with our system. It eliminates huge effort and ambiguity in system interaction.

Not sure if serious... SOAP, WSDL and everything else XML and XML Schema related is overkill for simple interfaces. For complex interfaces it is just - well too complex. If the time spent creating XML based web services that kinda but not really work (we're only talking interfaces here!) is spent documenting your JSON WS - you get quite a better experience. Ant this is the reason why everybody has switched to JSON.

I am serious, document a JSON interface with what, English? Are you serious?

JSON has no way to describe in machine readable way what to expect, instead you have to read a document then go hand code the interface in your language of choice.

WSDL and SOAP is not complicated, and I have implemented my own SOAP stack. Then again everyone now days everyone thinks relational databases are complicated.

If you you have tools that implement it for you then there is no excuse.

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

#110

Earlier quoted context omitted.

Yeah... no. I'm not a big code gen guy. But the google people seem to love them, so I'm probably in the minority.

> Yeah... no. I'm not a big code gen guy. Me either! Which is why I'm working on a high-performance Protocol Buffer library that does not do code generation: https://github.com/haberman/upb/wiki

Excellent readme for that project. It details several issues of which I wasn't aware.

Thanks for that.

(edit: It wasn't the readme, it was the wiki page. Still, excellent documentation.)

Post reply on HN