|
|
|
|
|
by bananas
4481 days ago
|
|
One of the core aspects of XML that is really important is that no typing is inferred by the structure of the file unlike JSON. JSON is by nature tied to the JavaScript type system which is sparse and inaccurate. For example, if you look at the following: { "name": "bob", "salary": 1e999 }
Ah crap! Deserializer blew (in most cases silently converting the number to null) <person>
<name>bob</name>
<salary>1e999</salary>
</person>
No problem. The consumer can throw that at their big decimal deserialiser.And the following is not acceptable as it breaks the semantics of JSON and requires a secondary deserialisation step as strings ain't numbers... { "name": "bob", "salary": "1e999" }
JSON is a popular format but it's awful. |
|
The problem I think is that just because XML is human-readable, it's less sufficient as a format that is human-writable (I'm looking at you, Maven!). I believe this is the root cause that many people hate XML, even though it has a very sweet spot in application-to-application communication.