3 ms·
> Fortunately, VSC allows comments between a // and a following newline. Yes, that's my point. If a human is required to look at the JSON it's not hard to find
by mpyne 4y ago
> Fortunately, VSC allows comments between a // and a following newline.
Yes, that's my point. If a human is required to look at the JSON it's not hard to find a parser that permits comments. So of course it would be supported if it was actually needed.
Even without that though, you can do something like the trick I used in a JSON-based format:
{
"__comment": "For help with this file, go to http://wiki.example.com/ http://wiki.example.com/...",
...
"foo": "..."
}
That does have the problem that your programs processing the JSON need to strip out keys with that name if it would interfere with the program. So it's probably easier just to add the line of code in your parser saying to permit comments.
Meanwhile, XML comments have issues of their own, as you have to be familiar with SGML rules on how -- are handled to safely use or edit XML comments. So while they are nice to have it's not as if they have no nuance either.