3 ms·
It's just a hack, but you can write a comment in a key that is supposed to be ignored: { "__comment": "The following config does...", "key": "val
by andreynering 11y ago
It's just a hack, but you can write a comment in a key that is supposed to be ignored:
{
"__comment": "The following config does...",
"key": "value"
}
But I agree that it is not much intuitive.
- spriggan3 11y agoJSON isn't semantic so there is no need to put __ before comment, it's not like it's meta or something. It will still be parsed and processed by the JSON parser, which is a waste of computer cycle.
- oconnor663 11y agoIt's kind of a future-proofing thing. If you put a field called "comment" in a JSON blob, especially one in a format you don't control, you run the risk that future versions of the format will define the "comment" field and give it actual meaning. A crazy prefix makes this at least slightly less likely.