Live data from Hacker News

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

blog.mongolab.com

61–70 of 133 posts

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

#61

Earlier quoted context omitted.

Hard to believe we had the right answer in 1960 yet are still afraid of the parens as an industry.

To be clear, the parent post is referring to the invention of LISP. As a side note, for those who don't know, JavaScript shares a number of features with LISP/Scheme. JSON has the trappings of the very LISPy idea of "Data = Code". It doesn't quite live up to it though. Now, if we only had a parenthesized syntax for JavaScript...

You can write "lispy" code with CoffeeScript, if you're feeling looney:

    (afraid (very (are (we))))
is valid syntax.

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

#62
post #50

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.

Apparently one doesn't need to be awake, sane or sober to become an enterprise "programmer".

Apparently one doesn't need to be awake, sane or sober to become a "programmer".

Fixed. I've seen plenty of crap programming everywhere, no need to pick on enterprise programmers.

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

#63
post #54

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 think the difference is that XML protocols are meant to be generated while JSON protocols are meant to be hand-written to some extent. Otherwise, what's the difference with: {'ret': 'pump me up'} And pump me up If it's a computer generating it?

The difference is that in JSON there's pretty much only one way to do it, the way you have there. With XML there's many ways to do it (see examples on this thread). So when using XML, you need to write code adapted to the way it's 'encoded'.

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

#64
post #51

JSON is so popular because it's data description abilities are poorer than that of XMLs. Everything in JSON can be easily mapped to a few basic types in any popular language, and so all the JSON writers/readers do exactly that. The consequence is that it's very easy to work with JSON. Contrast with XML, which has node attributes and children, to start with. This alone is sufficient to make it not as naturally represe…

JSON is an example of 'worse is better'.

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

#66

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 encountered that many times, with all the headaches involved. What is the reason for this?

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

#67

The baby that has been thrown out with the bathwater here is a schema/data description layer. NOT , I repeat NOT , I repeat NOT for verification but rather for tools, so that people working in strongly typed languages can interact with JSON services in a reasonable manner. Unfortunately the one option I see, JSON Schema, appears to have caught the XML/Java bug, and has gotten very complicated.

>[…] so that people working in strongly typed languages can interact with JSON services in a reasonable manner

You mean languages that lacks algebraic data types? Because JSON encodes beautifully in ML and Haskell, and their type systems are quite static and quite strong.

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

#68
post #54

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 think the difference is that XML protocols are meant to be generated while JSON protocols are meant to be hand-written to some extent. Otherwise, what's the difference with: {'ret': 'pump me up'} And pump me up If it's a computer generating it?

I think it is the other way around. XML is explicitly designed to be writable and editable by hand, which is also the reason for some of it's syntactic redundancy.

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

#69

The baby that has been thrown out with the bathwater here is a schema/data description layer. NOT , I repeat NOT , I repeat NOT for verification but rather for tools, so that people working in strongly typed languages can interact with JSON services in a reasonable manner. Unfortunately the one option I see, JSON Schema, appears to have caught the XML/Java bug, and has gotten very complicated.

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.

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

#70
post #58

you could do {"name": {"first": "John", "last": "Smith" } } even for json there's multiple ways you could do it. You could also include the person like XML did, but oh well...

With JSON, there's still a culture of doing things the simplest possible way. Sure, it won't eliminate all the variability, but the lighter syntax makes needless complexity more obvious.

For instance, if you don't need to separate the first name from the last name, {"name":"John Smith"} is obviously simplest. If you need to, and you have few other parameters besides the name, the OP's solution is obviously simplest. If there are lots, or if the name itself is complicated (first, last, mother's maiden name, pseudonym…), then your solution is obviously simplest.

Post reply on HN