Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not the worst ever (that would be YAML) but it does have an accumulation of annoying features.

* Elements and attributes (as you said).

* Text children mixed up with elements. These two are both good for writing documents by hand (i.e. HTML) but really annoying to process.

* Namespaces are frankly confusing. I understand them now but I didn't for years - why is the namespace a URL but there's nothing actually at that URL? 99% of the time you don't even need namespaces.

* The tooling around XML is pretty good but it's all very over-engineered just like XML.

* The syntax is overly complicated and verbose. Repeated tag names everywhere. Several different kinds of quoting.

* XML schema is nice but it would be good if there was at least some support for basic types in the document. The lack of bool attributes is annoying, and there's no standard way to create a map.

JSON is better by almost every metric. It is missing namespaces but I can't think of a single time I've needed that in JSON. Mixing up elements from different schemas in the same place is arguably a terrible idea anyway.

The only bad things about JSON are the lack of comments and trailing commas (which are both fixed by JSON5) and its general inefficiency.

The inefficiency can be sometimes solved by using a binary JSON style format e.g. CBOR or Protobuf. With very large documents I've found it better to use SQLite.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: