4 ms·
He's talking specifically about web APIs. Web APIs tend to have simple, shallowly nested formats. In an informal survey, the deepest nesting I found was 3 leve
by 6ren 15y ago
He's talking specifically about web APIs.
Web APIs tend to have simple, shallowly nested formats. In an informal survey, the deepest nesting I found was 3 levels. JSON is simple, and has resisted all efforts to complicate it, or to add to its stack. There is no popular schema for JSON, no "JSLT". no visual JSON mapping tools. The only tooling is databinding (and if you consider JSON as a subset of JavaScript, it arguably has not even that).
The XML toolchain, especially XML Schema and XSLT, is highly engineered - well, over-engineered. The designers threw in everything they could think of. As a result, even enterprise tools don't need to support the whole spec.
I think it's fair to say that if you need something more powerful (and therefore more complicated) than JSON, you should use XML. It seems the very existence of the XML toolchain helps keep JSON simple: instead of demand for complexity being channeled into over-tooling JSON, it is harmlessly diverted to XML.
The deeper question is: do our tasks really NEED that extra complexity? It seems related to loose dynamic typing vs. tight static typing (and scripting vs. compiled). Maybe web APIs are an exception - or, because very young, haven't yet needed the complexity that beset CORBA, then XML... Or maybe they are an exception, but it doesn't matter because everything is becoming a web API anyway. Or... maybe we're finally got it right...?
There are pervasive needs that JSON doesn't address. For example, there's a problem with coupling between JSON and application data structures in that they must be the same basic shape. So to give your JSON format the ideal shape for consumers, you need to translate into a layer of objects first - and your consumers need to do the same thing to get it into their internal data structures, Similarly, you aren't free to evolve; instead, you produce another version, and all your clients must upgrade. Most web APIs are very very young, yet have several versions already... The same problems occurred in XML (and CORBA), and though JSON is an improvement in that it allows fields to be added more easily, the tooling to support conversion/evolution hasn't grown up around it (and isn't growing).
I think the answer is that JSON works great when the underlying features of applications are changing quickly because you can't "evolve" around this, you need humans to rethink the basics. while "web APIs" continue in vigorous growth, it will dominate. Maybe it will settle down and consolidate, once everything has changed into a web API... or maybe continuous churn will become the rule, as everything accelerates?
[Interestingly, relational algebra squarely addressed and solved these problems 42 ago. It's still going strong; though also under attack by the similar forces (NoSQL) allied with loose dynamic typing of scripting languages, and the need for so-called "web-scale" performance being greater than the need for evolution/conversion... at present.]
- Yarnage 15y ago>For example, there's a problem with coupling between JSON and application data structures in that they must be the same basic shape. So to give your JSON format the ideal shape for consumers, you need to translate into a layer of objects first - and your consumers need to do the same thing to get it into their internal data structures, Don't you need to do the same-thing with XML? How do you use XML data without conforming it to your internal structures first? You can't just guess...I just don't get the difference here. I'm trying to understand what XML can offer that JSON cannot. Do you have an example? >Similarly, you aren't free to evolve; instead, you produce another version, and all your clients must upgrade. Same-thing here; doesn't XML have the same issue? Upgrading formats can make XML useless just as well as JSON. Also, just like JSON, you can upgrade them without issue so I'm not seeing the distinct advantage of XML over JSON. Do you have an example? I'm not trying to be argumentative; I just haven't seen any examples showing what makes XML better than JSON just lots of "you can't do this in JSON" and I can't find a way to make that true in my head...
- 6ren 15y agoYes, XML has the same problem. The end of that paragraph reads: > The same problems occurred in XML (and CORBA), and though JSON is an improvement in that it allows fields to be added more easily, the tooling to support conversion/evolution hasn't grown up around it (and isn't growing). Maybe it's not clear, but the tooling to solve these problems has grown up around XML. Mainly XSLT, and visual mappers that operate on top of that. Examples: MS's Biztalk mapper http://msdn.microsoft.com/en-us/library/aa547076.aspx http://msdn.microsoft.com/en-us/library/aa547076.aspx; MapForce http://www.altova.com/mapforce.html http://www.altova.com/mapforce.html; StylusStudio XML mapper http://www.stylusstudio.com/xml_to_xml_mapper.html http://www.stylusstudio.com/xml_to_xml_mapper.html; both IBM and Oracle have similar - this category of tooling has been around a decade or so; XSLT itself started in 1997 http://en.wikipedia.org/wiki/XSLT http://en.wikipedia.org/wiki/XSLT). Have a look at the images in those links - you'll immediately see what they do. So to be precise, XML doesn't solve these problems, its tools do.