by jerf · 12y ago · 0 comments
If you have more data than text, use JSON. If you have more text than data, use XML/HTML.
Imagine HTML documents encoded in JSON -- in that case JSON would be ugly and annoying to edit. Now imagine (the more common situation of) structured data serialized as XML. That is ugly and annoying to edit.
Use the right tool for the right job. :)
<Foo>Some text <Bar>more text</Bar></Foo>
while JSON does not. So there isn't a 1:1 mapping, at least not in the direction XML → JSON (and the other direction only works if you have a schema that defines data types for the document). {
'tag': 'Foo',
'children': [
'Some text',
{
'tag': 'Bar',
'children': ['more text']
}
]
}
or (hello, LISP) ['Foo', ['Some text', ['Bar', ['more text']]]]https://developer.mozilla.org/en-US/docs/Web/API/CDATASectio...