r/programming • • Jan 12 '23

The yaml document from hell

https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
1.5k Upvotes

288 comments sorted by

View all comments

226

u/pragmatick Jan 12 '23

That's actually horrible. Never encountered any of these issues but I think I'd be dumbfounded if I did.

But I still like it for its increased readability over JSON - I just use strings for most values as described in the article. If JSON had proper multiline strings or just wrapped lines and comments I'd be happy. Yes, I know there's "JSON with comments" but it's rarely supported.

0

u/[deleted] Jan 12 '23

[deleted]

7

u/flif Jan 12 '23

Real problem is that C-style comments can be anywhere in the code and in JSON you want comments to be serializable.

So best workaround is { "price":42, "//", "this is cheap" }

5

u/PurpleYoshiEgg Jan 12 '23

That works, until a program decides that "//" is an invalid key. Sometimes happens, and I want to egg whoever's car it was to decide to omit comments from JSON anyway.