Live data from Hacker News

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

blog.mongolab.com

111–120 of 133 posts

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

#111
post #34

Earlier quoted context omitted.

That because XML does not map well to Simula style OO. "Iterating" XML in XSLT (a language designed to manipulate XML) is way less of a pain.

I don't disagree with this, but I think there's something wrong when need another markup language to deal with the first markup language.

XSLT is XML, that whats nice about it, you can reflect on it.

XML has no operators for manipulating or evaluating, it is a metalanguage. XSLT adds this on top of XML to process XML.

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

#112
post #77

Earlier quoted context omitted.

That because XML does not map well to Simula style OO. "Iterating" XML in XSLT (a language designed to manipulate XML) is way less of a pain.

You've got to be kidding. I see the usefulness of XSLT, but still XSLT is a synonym to pain. Definitely one of the most ugly syntaxes I've ever. It has a place, it can be useful, but I thoroughly detest it.

Not kidding, XSLT is functional, it's very different from imperative style OO, it's not complex and can get a lot done with few lines of code.

If you think it's painful and ugly, then don't dig any deeper in computer science than javascript.

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

#113
post #68
post #54

Earlier quoted context omitted.

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.

If you think XML is writable, you are a bigger man than me.

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

#114

Earlier quoted context omitted.

Are you really having to deal with the SOAP protocol yourself? I mean, their are libraries that handle all this for you. Just read in the WSDL, and call the methods as you need them. No need to muck around with XML.

Of course there are libraries that do all of this stuff - and they work nearly all the time. However, when they stop working you end up having to look at what is actually going over the wire (or WDSL if you are really unlucky) to try and work out what on earth is going on. 98% of the time SOAP works without too many problems - the trouble is that those other 2% of cases can be truly awful to debug because you have th…

Typo: should have been WSDL

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

#115

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…

Two words: external references [1].

XML is a data representation that desperately wants to be Turing complete through syntax.

And then they call their schema definition language (because defining XML schema is practical by using a specialized language) RELAX...

You can't make this stuff up.

[1|http://books.xmlschemata.org/relaxng/relax-CHP-10-SECT-1.htm...]

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

#116
post #90

Earlier quoted context omitted.

I'm a little embarrassed to admit this, but when I first read your post, I honestly thought that you were giving an example of how simple XML can be! After all, I can quickly glance at this bit of XML and understand what it is intended to represent. This doesn't look like SOAP-style xml to me at all, it looks like simple XML over HTTP. It gets so much worse that this. Much of the generated XML I've seen (especially t…

In fairness, I pared down the example for clarity (and to protect the guilty).

Oh, it wasn't meant as a criticism. I think my original misperception just strengthens your point. XML written as simply as possible is still more complicated than JSON.

That said, I feel about XML much the same way I feel about Java. They are typcially more complicated and verbose than the alternatives, but I don't think you can pin the horrendous level of complexity on the languages themselves. There seems to be a stronger cultural distain for complexity in the communities around other frameworks and languages, and JSON reflects this.

Everyone is (in theory) opposed to "unnecessary" complexity. The real issue is where you draw the line. For some reason, the python/django and ruby/rails communities seem more inclined to say "no" to complexity, even if it means giving something up. To turn it around, you have to get a hell of a lot of benefit to convince rails/django people to accept the overhead of additional complexity. I'm not sure why - maybe this is because these frameworks were created by people who were agast at what they saw developing in the Java world?

This seems to be the case with JSON vs XML as well. XML isn't going to be as simple as JSON, but there's no reason you can't describe data in XML in a way that is concise, reasonably, simple, and easy to read (both for people and computers).

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

#119

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.

Hm. I never heard of XJsonX, but it would be a trivial logical extension of JsonX (http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/inde...)

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

#120

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…

I've seen CDATA elements that contained complete XML documents including other CDATA elements. Good thing they had a hand rolled non-standard XML parser that allowed nested CDATA tags.

I noticed it when I wanted to read the doc in with tinyXML while working 70 hour weeks to fix up some other issue before a deadline. I ended up doing a memset(nestedXMLStart, ' ', nestedXMLLength) as a preprocessing step to bulldoze the whole construct. Not pretty, but it worked.

Post reply on HN