4 ms·
> We could have just as easily exchanged data with JSON (if it had existed) or CSV or protobufs or whatever JSON & CSV, whilst undoubtedly simpler formats, sti
by shady-lady 8y ago
> We could have just as easily exchanged data with JSON (if it had existed) or CSV or protobufs or whatever
JSON & CSV, whilst undoubtedly simpler formats, still lack the 'power' of the XML ecosystem.
Powerful tools to create a schema which can be used to easily view info about data/validate data etc..
Interesting to see people try to use JSON for config aswell. That's never going to end well.
- virgilp 8y agoI don't know. It's not exactly JSON, but I like HOCON configs a whole lot better than XML ones.
- tannhaeuser 8y agoI'm not disagreeing, but there's a case for simplistic config via JavaScript object literals in native JavaScript apps (node.js and browser apps). Of course, once you confine yourself to the JSON subset of JavaScript object literals, you'll soon find yourself wanting commenting syntax and other things. What I don't get is people using JSON religiously in apps that are neither using JavaScript, nor provide browser-facing web services. For example, in Java you'd need to do the exact same things for JSON serialization that you'd be doing for XML serialization (eg. jackson/jackson-xml or JAXB annotations on POJOs). The case for XML as service payload IMHO is when you need an upfront design with schemas and all for multi-party or vertical data exchange (such as for payment providers to stick to TFA's topic).
- dullgiulio 8y agoThe real difference between XML and JSON is that XML is not directly serializable to a data structure because it's too "rich", with both tag attributes and values. For serializing data DOM, XPath etc are really not the right fit.
- tannhaeuser 8y agoI agree. SGML/XML was invented for representing and editing semistructured text, not as generic data serialization format. In markup text, attributes are for data that isn't to be rendered itself, but for specifying how rendering should be performed and other things (how CSS fans thought it would be a good idea to make up an entire new ad-hoc language for this purpose, then reclaiming "HTML is for content not presentation" is another discussion). But the NoXML/JSON folks haven't really come up with a widely used alternative to eg. XML Schema (which isn't surprising since JavaScript isn't statically typed). The majority of the work where standardization of message payloads is useful (such as for parties in e-Commerce) has already been carried out. The world hasn't and couldn't have waited for JSON to become a viable alternative. Besides, what makes JSON so practical - that it is schema-less - is exactly the reason it isn't a good fit for describing upfront protocols for long-term multi-party data exchange.
- enriquto 8y ago> JSON & CSV, whilst undoubtedly simpler formats, still lack the 'power' of the XML ecosystem. "Power" is often a compromise. There are convincing arguments that plain text is, after all, more powerful than JSON, CSV and XML. It all depends on the context where this power will be exerted. If you only need to store name-value pairs, it may be better (e.g., more robust, more powerful) to use scanf("%s=%d", &name, &value); than to depend on a particular json or xml implementation.
- heavenlyblue 8y agoAnd then someone puts "=" in your key value.
- enriquto 8y agoPray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?
- Thiez 8y agoSo any url with url parameters (e.g. `?foo=bar`) are forbidden as values? Seems like a rather big sacrifice to make for simplicity.
- tannhaeuser 8y agoNo, it's only forbidden as part of keys. Assuming newlines are used to delimit the value, it's newline chars you can't use in values, though.
- koolba 8y ago... and then your combine the two by saying that the text for the value is JSON encoded so \n can be used for new lines.
- paulddraper 8y ago
- vesak 8y ago>Interesting to see people try to use JSON for config aswell. That's never going to end well. Some people are trying to use YAML for that too.