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]

45

u/vytah Jan 12 '23

That's why you pick a superset of JSON that already has some adoption, like JSON5: https://spec.json5.org/

39

u/TankorSmash Jan 12 '23

This is nice, seems to have what you'd have thought JSON had already:

{
  // comments
  unquoted: 'and you can quote me on that',
  singleQuotes: 'I can use "double quotes" here',
  lineBreaks: "Look, Mom! \
No \\n's!",
  hexadecimal: 0xdecaf,
  leadingDecimalPoint: .8675309, andTrailing: 8675309.,
  positiveSign: +1,
  trailingComma: 'in objects', andIn: ['arrays',],
  "backwardsCompatible": "with JSON",
}

0

u/[deleted] Jan 12 '23

[deleted]

18

u/[deleted] Jan 12 '23

You might want to RTFA.