2 ms·
I agree YAML is awful. JSON is ok if you allow comments at least (for configuration use cases). There are a couple of variants that do: JSON5 and Jsonnet. I lik
by IshKebab 2y ago
I agree YAML is awful. JSON is ok if you allow comments at least (for configuration use cases). There are a couple of variants that do: JSON5 and Jsonnet. I like JSON5 for it's relative simplicity but Jsonnet has much better ecosystem support so I'd probably go with that.
XML is just terrible though. Unless you have a proper schema everything is entirely untyped (tbf the schema support is pretty good). But more to the point it just doesn't map to normal programming language objects cleanly. It's a document markup language, not an object encoding.
That means there's an annoying mismatch when parsing for 99% of use cases.
Couple that with the crazy verbosity and the weird confusing features like namespaces... I think I would rather use YAML to be honest, even though it is really bad.
Since YAML is a superset of JSON I sometimes actually use JSON with `#` comments, and read it as YAML. Only downside is nothing checks if you are using that format correctly.
- dagss 2y agoJSON numbers have such huge issues that I would question that JSON has types either.. I have seen real life examples of some developers putting money as a decimal in JSON, then other developers using some default parsing into float and finally truncate that float on conversion to Decimal money to loose 1 cent. I have also seen examples of developers putting int64 random IDs in JSON interacting with Azure Cosmos, then discover that when fetching data back the numbers had been silently rounded to 53 bits! (i.e., float64 precision) JSON does not document at all how its numbers should behave, making it useless for a lot of things. Honestly prefer XML, being honest about not having typing. Don't get me started on YAML and types..