logoalt Hacker News

fodkodrasztoday at 9:12 AM10 repliesview on HN

There is no problem with YAML, just like there was no problem with XML at all. The problem is with the software devs who use it for the wrong thing. I just wonder why JSON doesn't get all the hate, while it is a terrible format also: it is not streamable (YAML is), it doesn't have comments... and non-standard workarounds are used for these features. Norway better than YAML, in my opinion.


Replies

Dititoday at 9:23 AM

I also wonder why it’s the 2012 version of the language which gets all the hate, instead of the hate being directed at Google, who doesn’t care about putting resources towards updating the main offender, Kubernetes’ YAML 1.1 parser. https://github.com/kubernetes/kubernetes/issues/34146#issuec...

show 2 replies
throw0101atoday at 11:35 AM

> I just wonder why JSON doesn't get all the hate, while it is a terrible format also: […] it doesn't have comments […]

The lack of comments in JSON is not a bug; comments in JSON were an anti-feature. Douglas Crockford intentionally removed them to prevent developers from using comments to store parsing directives (which he saw people doing in earlier revisions).

* https://web.archive.org/web/20120507093915/https://plus.goog...

* 2012: https://news.ycombinator.com/item?id=3912149

show 1 reply
vkazanovtoday at 9:48 AM

There numerous problems with YAML. It is underdefined, ambiguous, fragile, and is just impossible to write a portable parser for.

JSON is naive, lacks almost everything. But is supereasy to parse and read.

As funny as it sounds, XML is overspecified. Parsing is possible and predictable but supporting the full standard (all of them) is so much work that nobody does it anyway.

So, given the choice above, i'd go for naive simplicity.

show 1 reply
patricktheboldtoday at 11:47 AM

What do you mean that JSON is not "streamable"?

There are things like https://www.baeldung.com/jackson-streaming-api but maybe there's more in you definition of "streamable" that JSON doesn't satisfy.

_ink_today at 9:21 AM

There are plenty of problems with YAML as the article shows. The biggest problem with YAML is, that serializer and deserializer need to agree on rules outside of the spec, because otherwise they can be both compliant and still don't understand each other.

show 1 reply
hatthewtoday at 9:47 AM

I find json annoying to write a lot of the time, but I do enjoy that it's a lot more difficult to get wrong than yaml. The json spec is pretty clear, and can be learned and memorized by any programmer in 5 minutes. I'd much rather write in a format that's slightly annoying than a format that's slightly ambiguous.

dghftoday at 9:44 AM

YAML is (or at least, is declared by its maintainers to be) a superset of JSON, making any JSON document also a valid YAML document.

So surely if YAML is streamable, JSON must be too?

Or are the YAML maintainers incorrect?

show 3 replies
NuclearPMtoday at 11:46 AM

What is Norway? Couldn’t find a reference to it.

show 1 reply
einpoklumtoday at 9:38 AM

> Norway better than YAML, in my opinion.

I agree that Norway is better than YAML. Let's keep Norway and dump YAML.

> There is no problem with YAML

I am reminded of: "There are no American infidels in Baghdad. Never!"

mogohtoday at 9:33 AM

I, for one, hate JSON.