News for hackers. Stuff that matters.
Re:Toml: Tom's Obvious, Minimal Language by suby on Friday July 13, 2018 @07:37PM (#17527722)
I'm personally doing something similar in a C++ project that I'm working on. I designate comments with a //. When I load the JSON file, I go line by line removing comments as I find them. Once the file is parsed you can feed it into any regular JSON parser (personally I'm a fan of https://github.com/nlohmann/json).

Using JSMin would have been a much better idea. At this point though the only downside is that I haven't yet done this for saving JSON. It's a harder problem but I don't see why it wouldn't also be doable.

edit: Apparently this library allows you to have comments, and will even preserve them when saving the JSON file.

https://github.com/open-source-parsers/jsoncpp

Re:Toml: Tom's Obvious, Minimal Language by frumiousirc on Saturday July 14, 2018 @08:18AM (#17530022)
You could use libjsonnet++ instead of a custom reader to gain the extension of using comments. Of course, Jsonnet is a gateway drug to a much more sophisticated superset of JSON.
Re:Toml: Tom's Obvious, Minimal Language by spiralx on Saturday July 14, 2018 @12:17PM (#17530904)
There's the JSON5 format that supports comments, there are libraries available for parsing and encoding it.