Hacker News new | ask | show | jobs
by j45 525 days ago
JSON is great in it's own regards but the features are not comparable.
1 comments

At least with XML, you can have custom datatypes, not just strings and numbers and booleans.

In all seriousness, everything in JSON can be expressed as XML; but not necessarily the other way around.

So incredibly true. And that one time you see what XML can do that little else can.

Like that time there were hundreds of forms to build, refused, held a silent protest until a reasonable way presented itself.

Enter "XML Form Template" or "XML Form Definition.", A form is generated from the XML in html, filled in, and on submit, the XML is filled back in.

Built one form renderer and done. Never got old watching it.

XForms (W3C standard)

https://www.w3.org/TR/2003/REC-xforms-20031014/slice2.html

Other way around works too (I gave an example above), it's just not pretty in either direction.

XML makes sense for open-ended, human-written things like documents or apps. It doesn't work so well for APIs and other machine-read/written things where you'd normally use JSON.