this post was submitted on 13 Nov 2023
108 points (82.5% liked)

Programmer Humor

19512 readers
323 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 

And I'll show you YAML

(a continuation of this post)

you are viewing a single comment's thread
view the rest of the comments
[–] magic_lobster_party@kbin.social 53 points 1 year ago (2 children)

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.

[–] jjjalljs@ttrpg.network 30 points 1 year ago* (last edited 1 year ago) (3 children)

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.

[–] OmnipotentEntity@beehaw.org 12 points 1 year ago (1 children)

Change to Haskell formatted commas and the problem goes away :D

{ "a": 1
, "b": 2
, "c":
    [ 3
    , 6
    , 9
    ]
}
[–] ursakhiin@beehaw.org 32 points 1 year ago

Where is the nearest fire to dump this comment in?

[–] adambowles@feddit.uk 7 points 1 year ago

Trailing commas are supported in json5, as well as comments

[–] Sgtmoustache@lemmy.world -3 points 1 year ago (2 children)

I'm pretty sure you can have trailing commas...

[–] Bjornir@programming.dev 2 points 11 months ago (1 children)

You can't but some parser allow them. But those that do do not respect the standard.

[–] Sgtmoustache@lemmy.world 1 points 11 months ago

Good to know. Must be why I thought you could. Thanks.

[–] kool_newt@lemm.ee 3 points 1 year ago (1 children)

There should be a "Simple YAML" that is just scalars, lists, and dicts.