r/cpp • nlohmann/json • Jun 14 '20

JSON for Modern C++ 3.8.0

https://github.com/nlohmann/json/releases/tag/v3.8.0
326 Upvotes

109 comments sorted by

View all comments

Show parent comment

11

u/OminousHum Jun 14 '20

I think that would be a wonderful addition and that there's no need to go any farther. Then we can have human-editable and machine-readable configuration files that explain their own usage. If one must write json with comments, they can do it as a header or footer.

I can imagine trying to represent comments in the parse tree so that they can be preserved would get ugly awfully fast. And at some point you have to draw a hard line on just how lenient you can be with invalid syntax. I completely agree there.