Comment by da_chicken
2 days ago
It's hard to look at Java and not see it as a transitional language now. Electron, Node, and even .Net have fundamentally been more successful implementing ideas that first saw widespread adoption in Java. JSON is basically XML, which is what Java pushed so hard for for data exchange instead of really gross binary serialization formats.
Although, Java wasn't really trying to compete with C++ everywhere. It's just that, at the time, C++ was used at all levels. I mean, this was a time when it was C++, Visual Basic, or Turbo Pascal/Delphi for application programming. You couldn't easily get more abstract than that. That's wildly unlike today's landscape.
> JSON is basically XML, which is what Java pushed so hard for for data exchange instead of really gross binary serialization formats.
JSON over XML is more of a "better is better" case, though.
If XML dropped attributes and required everything to be an element -- which people always want to object to because they've used XML wrong their entire careers, but that's exactly what JSON did -- if they did that, and then also permitted `</>` as a universal close tag so that nesting isn't really a problem... which, again, is exactly what JSON did (and SGML)... then I think XML would not be so maligned. Like the problem with XML isn't that it wasn't capable. It's that it had too many features that actually aren't useful, and features that are distracting to the point of making people use it wrong.
Because almost the entirety of the remaining JSON ecosystem is just duplicating what XML did. We have JSON Path and JSON Query. We have JSON schema. There's even JSLT, although it didn't inherit the flaws of that XSLT library. About the only thing there still seems to be an argument about that XML did is JSON comments.
And, to be clear, JSON's perception as being better performing primarily comes from the fact that web browser developers had a vested interest in making JavaScript engines high performance for ordinary JavaScript, and they spent more effort on that than on their XML libraries simply because it was more important. That means the problem with the web hasn't been the use of XML. It's been the way we stapled half a dozen languages together to do one thing: display a document as a computer interface.
But if you use XML to the minimal level as JSON requires by it's nature, and if XML had gotten the performance interest that JavaScript did, then XML would be fine.
So I don't think JSON is better than XML. I think JSON just got lucky.
I couldn't possibly agree more. I remember the first time I saw JSON over HTTP. Within a week, I started ripping out all the SOAP code I'd written because "that's what you're supposed to use". JSON plus a few standard verbs is better than the old XML web services in every way.