3 ms·
I've seen people put "//" keys in their json lol
by xgulfie 2mo ago
I've seen people put "//" keys in their json lol
- stronglikedan 2mo agoIt's not terrible as far as I know, and it's less ambiguous than putting a "comment" key. I like it!
- reddalo 2mo agoI've also seen using "__" as a key for comments. I think it's better because it doesn't need to be escaped.
- hutattedonmyarm 2mo agoThere _is_ a json variant with comments, so that’s what you’ve seen. Not all parsers support that though
- jeroenhd 2mo agoIt's non-standard JSON, so you can probably just assume most patsers don't support any given commented parser. At least XML permitted comments, fhe shift to JSON on everything almost makes me nostalgic.
- DenisM 2mo agoWhen you get too nostalgic just think back to XSD type system in Xquery. That should cure the nostalgia real fast.
- xgulfie 2mo agoAre you denying what I've seen with my own eyes? I am saying it was an object like this: { "//":"make sure these are divisible by 8", "width": 640, "height": 480 }
- wincy 2mo agoNot the person you’re replying to but you were clear in what you were describing. It seems like they were thinking of some json parsers that’ll ignore just straight up anything after // before a new line in JSON (looking at you visual studio). So a .NET dev who has never touched anything but Visual Studio may make comments in the appsettings.json for a .NET project and it made all my command line parsers throw errors. Thanks Microsoft.
- hutattedonmyarm 2mo agoOooh, I misunderstood. I thought you were seeing this: https://jsonc.org/ https://jsonc.org/
- frollogaston 1mo agoI would still prefer that goofiness over YAML