Last post Jan 12, 2019 10:12 PM by bruce (sqlwork.com)
Jan 12, 2019 01:54 PM|Bill Tank|LINK
I'm trying with JSON file. Can I use comments in a JSON file? If possible can you please describe?
Thanks for your answer!
Jan 12, 2019 02:02 PMemail@example.com|LINK
In JSON should all be data. If you include a comment that will be data too.
You could have a designated data element called "_comment" (or something) that would be ignored by apps that use the JSON data.
You would probably be better having the comment in the processes that generates/receives the JSON.
Please don't forget to mark as answer if it helps you. Thanks!
Jan 12, 2019 02:31 PM|Bill Tank|LINK
So, you want to say comments are not possible in JSON
Jan 12, 2019 02:35 PMfirstname.lastname@example.org|LINK
Hi Bill Tank,
Yes, you can have comments. But I will not recommend whatever reason mentioned above.
I did some investigation, and I found all JSON require methods use the JSON.parse method. So I came to a solution: We can override or do monkey patching around JSON.parse.
Jan 12, 2019 10:12 PM|bruce (sqlwork.com)|LINK
the JSON spec does not included comments. if you write your own "JSON" parser, then you can support any changes to the JSON protocol you want. the spec is pretty simple: