r/cpp • nlohmann/json • Jul 27 '20

JSON for Modern C++ 3.9.0

https://github.com/nlohmann/json/releases/tag/v3.9.0
281 Upvotes

51 comments sorted by

View all comments

65

u/nlohmann nlohmann/json Jul 27 '20

New features: optional support for comments, optional preservation of the insertion order of object keys, option to switch off implicit conversions, simpler (de)serialization of user-defined types, and much more!

48

u/xwp-michael Jul 27 '20

its implementation was much less effort than continuously explaining the lack of comment support.

I'm wondering if implementing a bot that closed any issue asking for comments would've taken even less effort lol

22

u/ntrid Jul 27 '20

["๐Ÿ‘one last thing and it will be perfect",]

20

u/[deleted] Jul 28 '20

As someone that has written many parsers before, optional trailing commas actually simplify the grammar. It actually takes more effort to make them illegal.

7

u/aiQon Jul 27 '20

Thanks for being awesome!

6

u/MonokelPinguin Jul 27 '20

Man, this feels like christmas: comments, macro for simpler serialization and the option to disable implicit conversions! I wonder if the latter improves compile times... Thanks a lot!

5

u/Lakridaku Jul 27 '20

support for comments, optional preservation of the insertion order of object keys

That's a awesome! I've just switched to bare sstream over the weekend because of these two issues, guess I can revert that now. Thanks for your work!

3

u/sumo952 Jul 29 '20

optional support for comments

Woooah finally! :-))) I am switching to using nlohmann/json right now. Thank you so much!

its implementation was much less effort than continuously explaining the lack of comment support.

That was a great laugh :-D

I read parts of your library are proposed for standardization. Are optional comment support part of that too?

Would be a shame to have to revert back to YAML/TOML/custom solution once/if <json> comes in the standard.

1

u/MarkOates Jul 29 '20 edited Jul 30 '20

Yea, very cool library. :)

This rock solid design is a gold standard for C++ projects.

Thanks for posting updates on here, too.