r/ProgrammerHumor • • 14d ago

Meme commentsInJson

Post image
6.0k Upvotes

202 comments sorted by

View all comments

Show parent comment

19

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

14

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

2

u/Cisco-NintendoSwitch 14d ago

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

7

u/stipo42 14d ago

Then your marshalling library throws "unexpected key"

3

u/TerryHarris408 14d 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 14d ago

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

2

u/Meltz014 13d ago

"additionalProperties": false

1

u/stipo42 14d ago

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