Norway.
Ups. Sorry, I meant “NO”.
deleted by creator
Serializing? For serializing you probably want performance above all else. I’m saying this without checking any benchmark, but I’m sure yaml is more expensive to parse than other formats where indentation don’t have meaning.
For human readability: it has to be readable (and writeable) by all humans. I know (a lot of people) that dislike yaml, toml and XML. I don’t know of a single person that struggles to read/write json, there is a clear winner.
deleted by creator
Serializing isn’t necessarily about performance, or we’d just use protobuf or similar. I agree Json is a great all rounder. Combine with JSON object schema to define sophisticated DSLs that are still readable, plain JSON. TOML is nice as a configuration language, but its main appeal (readability) suffers when applied to complex modeling tasks. XML is quite verbose and maybe takes the “custom DSL” idea a little too far. YAML is a mistake.
JSON would be perfect if it allowed for comments. But it doesn’t and that alone is enough for me to prefer YAML over JSON. Yes, JSON is understandable without any learning curve, but having a learning curve is not always bad. YAML provides a major benefit that is worth the learning curve and doesn’t have the issues that XML has (which is that there is no way to understand an XML without also having the XSD for it)
Json should also allow for trailing commas. There’s no reason for it not too. It’s annoying having to maintain commas.
My problem with yaml is if you truncate it at any random spot, there’s a high likelihood it’s still valid yaml. I don’t like the idea that things can continue without even knowing there’s a problem. The single opening and closing curly braces enclosing a json object is all it takes to at least know you didn’t receive the entire message. Toml has the same issue. I’ll stick with json when it makes sense.
Add a schema to it and you get XML. The ultimate serialization format.
Quite like YAML, XML has too many stuff in it. While a lot of parsers are not standard compliant and safe, if there’s any chance the stuff you include on your code can evolve into a fully featured parser, including it is something to avoid.
There is this language called KDL that looks interesting.
Json. Your move, Joker.
So much json here. All wrong, it’s csv
Yaml is a great, human-readible file format. Unless there’s an exclamation point in it, then it is an illegible Eldrich horror.
Genuinely curious what features OP is looking for, specifically for serialization as per the post, that has resulted in the conclusion being yaml.
deleted by creator
text?
deleted by creator
Protobuf is also not a proper binary alternative for Yaml. Protobuf needs a schema in the form of its IDL. Cbor and messagepack might be more analogous.
JSON for serialization all the way. It’s simple and to the point. It does one thing and does it well. There’s little room for annoying surprises. Any JSON can easily be minified and prettified back and forth. If you want it in binary format you can convert it to BSON.
Yaml is too much of a feature creep. It tries to do way too many things at the same time. There are so many traps to fall into if you’re not cautious enough. The same thing can be written in multitudes of ways.
Yes, but whoever decided that json can’t have trailing commas has my ire.
{ "a": 1, "b": 2, <-- nope }
There was some other pitfall I can’t remember around missing keys and undefined, too, but I can’t remember it now.
Change to Haskell formatted commas and the problem goes away :D
{ "a": 1 , "b": 2 , "c": [ 3 , 6 , 9 ] }
Where is the nearest fire to dump this comment in?
There’s a special place in hell for the inventor of semantically significant whitespace.
YAML itself is one of the circles of hell. You have to copy-paste YAML from web etc sources with dubious formatting for all eternity, and the editor doesn’t have YAML support. Also you can only use Python
For serializing? I’d probably just go with json.
For content meant to be written or edited by humans? YAML all day baby