|
|
|
|
|
by suby
2894 days ago
|
|
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 |
|