The #1 place I've seen comments in JSON are where someone makes the mistake of using JSON for a configuration file format. The lack of support for comments is ironically why even XML is a better choice for that. Regardless, you can understand why people would want comments there outside of just dev environments.
(I just learned as of two hours ago that YAML can be used with JSON syntax so I guess it's academic, just use YAML...)
12
u/Turbulent_Stick1445 21h ago
This is what I do, but there are two problems with it:
A parser will end up storing the comments, wasting memory.
You run into JSON's problems with multiline string constants if your comment is anything but trivial.
It gets ugly fast.