r/ProgrammerHumor • • 7d ago • Bravo 1

Meme commentsInJson

Post image
6.0k Upvotes

205 comments sorted by

View all comments

Show parent comment

19

u/HipstCapitalist 7d ago
{"__comment__": "A comment"}

14

u/meifray 7d ago
{
    "key":"value",
    "key_comment":"le comment"
}

2

u/Cisco-NintendoSwitch 7d ago

Shitpost aside do people actually do this? I’m a Platform Engineer so YAML all day (Terraform / Ansible)

7

u/stipo42 7d ago

Then your marshalling library throws "unexpected key"

3

u/TerryHarris408 7d ago

they do that? I need to get my nlohmann up to that point. would help me a lot with schema migration tests

2

u/TerminalVector 7d ago

It's usually a config option to either error or silently discard an unexpected key

2

u/Meltz014 6d ago

"additionalProperties": false

1

u/stipo42 7d ago

Some do, some don't, some can. Just read the docs