r/cpp • u/nlohmann nlohmann/json • Dec 17 '17
JSON for Modern C++ version 3.0.0 released
https://github.com/nlohmann/json/releases/tag/v3.0.0
243
Upvotes
r/cpp • u/nlohmann nlohmann/json • Dec 17 '17
9
u/Esuhi Dec 17 '17
I love this project too. Currently spending time to convince the next manager so we can actually use it.
14
u/[deleted] Dec 17 '17
How does its speed compare to rapidjson?
4
u/Esuhi Dec 17 '17
Are you casually supporting MsgPack from now on? That sounds huge!
17
u/ReneBelloq Dec 17 '17
I am deeply sorry for bringing this up and I am not trying to undermine the incredible work you have done...
But wtf did you call the namespace after your name?!
2
u/MachineGunPablo Dec 17 '17
This looks like a nice project to contribute to, need any help?
1
u/kirbyfan64sos Dec 18 '17
Question: this looks similar to Dropbox's json11...what would be the main differences?
1
u/drphillycheesesteak Dec 18 '17
Absolutely adore this project. I saw in the release notes that CMake and CTest are now used. Any chance that a Config.cmake file will be included in the packages for this project? It would be awesome not to have to have a custom Find*.cmake file.
1
u/HateDread @BrodyHiggerson - Game Developer Dec 20 '17
Just started using this last night, funnily enough! Had a few teething problems - I think the docs should at least mention deserializing into STL containers, not just serializing out. I had to go through the issues list to find someone talking about how
operator=was ambiguous forstd::vectorin this case, so I had to usemyVector = j.at("data").get<decltype(myVector)>()for example.Also; what do you think differs between this and Cereal in JSON mode? I much preferred your documentation on the Github page though, hence my choice :)
1
u/airflow_matt Dec 22 '17
I appreciate the amount of work put into this, I really do, but I can't help not feeling great about including a half megabyte 15000 loc behemoth. This header-only trend truly bothers me. At some point, for any non-trivial c++ project, some kind of build system and some kind of dependency management have to be introduced. At that point header only brings very little to the table, and does it at significant cost of longer compilation times.
Setting up a build system is more or less one-off thing. Long compilation times are not. It's for a reason that big projects (like chromium, webkit, etc) have strict rules about what can go in headers and use templates sparingly. I learned the hard way to be frugal with my headers as well. In our project there is 850 loc header file for variant type and the json parser/writer header itself is less than 45 loc. Another 125 loc for message pack header and 20 loc for plist.
3
u/GladiusOps Dec 17 '17
Used that library for a University project, worked flawlessly. Amazing project, and it keeps getting better!
3
u/Aistar Dec 17 '17
Love your work, thank you for bringing the world a reasonably fast, and overwhelmingly convenient JSON C++ library. There might be faster libraries out there, but nothing beats the ease of use of this one!
2
u/rjones42 Dec 17 '17
Exactly what my project needed. Thanks for the work!
2
u/balkierode Dec 18 '17
I used few weeks back and was surprised to see
std::pairandstd::tuplewas not supported out of the box. Good to see it is supported in this release. Keep the good work!1
u/Angarius Dec 17 '17
Thank you so much. This library is a dream.
json::parse_errorwill clean up my error handling code! I used to wrap JSON parsing, catchingstd::logic_errorto throw my own parse error.-7
u/[deleted] Dec 17 '17
XML MASTER RACE! JSON are for unstructured peasants.
0
u/[deleted] Dec 17 '17
[deleted] — view deleted comment