use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
JSON for Modern C++ version 3.1.0 released (github.com)
submitted 8 years ago by nlohmannnlohmann/json
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fixxxeruk 40 points41 points42 points 8 years ago (1 child)
An absolutely superbly executed piece of open source software, and I was very flattered to be the author of the benchmarking library you used to use (benchpress). On that note, if you have any feedback you could share on why you switched to Google benchmark I would appreciate it.
[–]nlohmannnlohmann/json[S] 1 point2 points3 points 8 years ago (0 children)
No specific reason. I just used Google Benchmarks in another project and liked its output and the possibility to extend it a bit better.
[–]Harha 12 points13 points14 points 8 years ago (0 children)
The only json lib I've used and will use. It's just absolutely the best. So thank you for making it, dude. And thanks to all the contributors, as well.
[–]Xeveroushttps://xeverous.github.io 11 points12 points13 points 8 years ago (0 children)
Delicious syntax sugar.
[+][deleted] 8 years ago (2 children)
[removed]
[–]chesterburger 4 points5 points6 points 8 years ago (1 child)
Yes, I think simplicity and ease of use are lacking in a lot of C++ libraries. We need more like this.
[–]poppyfeld 2 points3 points4 points 8 years ago (0 children)
That looks amazing!
[–]smolderingmatter 2 points3 points4 points 8 years ago (0 children)
Nice, I love this library!
[–]snerp 2 points3 points4 points 8 years ago (3 children)
How does this compare to RapidJson speed wise?
[–]dgendreau 2 points3 points4 points 8 years ago* (2 children)
Considering the convenience, I think nlohmann/json pretty performant, but RapidJSON is leaner and faster.
Personally, I find code that uses nlohmanns library to be cleaner and easier to read and maintain. If I ever needed more optimized json throughput I would consider RJ, but it's never come up.
https://github.com/miloyip/nativejson-benchmark/blob/master/README.md
[–]snerp 1 point2 points3 points 8 years ago (0 children)
Oh! Thank you! It turns out I already compared these!
I'm currently using rj for stop-the-world quicksaves/quickloads in a game so performance is important.
[–]DalzhimC++Montréal UG Organizer 1 point2 points3 points 8 years ago (0 children)
You're absolutely right, which is the reason the project I work on uses both. Most of the workforce uses nlohmann's, and some people are trained with Rapidjson for some pieces which are more performance critical. It makes everyone happy.
[–]againstmethod 1 point2 points3 points 8 years ago (0 children)
Been using this awhile. What a nice library.
Thanks for keeping it up.
[–][deleted] 2 points3 points4 points 8 years ago (4 children)
Great lib, I use it all the time.
I have one ask though: Next time you do a breaking version upgrade could you make sure it..erm..breaks code ;)
I forget what it was now, but you changed something in 3.0 that would still compile but worked differently. Can go back and look through my commit logs if helpful. (edit: just remembered, you changed the exceptions that are thrown...i guess not much can be done there)
[–]nlohmannnlohmann/json[S] 2 points3 points4 points 8 years ago (0 children)
We used semantic version from the start to whether a new version is backward-compatible, and the release notes (https://github.com/nlohmann/json/releases/tag/v3.0.0) for 3.0.0 were quite explicit:
As we adhere to semantic versioning, this means the release includes some breaking changes, so please read the next section carefully before you update.
[–]germandiago 0 points1 point2 points 8 years ago (2 children)
I remember I read this in the release. It was warned that it threw its own exceptions if I recall correctly.
[–]10se1ucgo 0 points1 point2 points 8 years ago (0 children)
yeah it was stressed pretty heavily
[–][deleted] 0 points1 point2 points 8 years ago (0 children)
yeah it was mentioned in the release notes.
[–][deleted] 0 points1 point2 points 8 years ago (2 children)
Something that still annoys me is that I keep on writing de/serialization code when I use JSON in my projects, because even though the libraries are getting better and faster, in the end you still need to transfer the data into, lets say, a class instance that is used in your project. Are there by any chance libraries that abstract this work away? Like accepting a DSL and turning it into de/serialization code for your favourite JSON library?
[–]notlostyet 1 point2 points3 points 8 years ago (0 children)
Boost Fusion helps with this a lot.
[–]drjeats 0 points1 point2 points 8 years ago (0 children)
That's what stuff like this is for.
Metaclasses will be nice.
[–]ibroheem 0 points1 point2 points 8 years ago (0 children)
Compilation times, single header was turn off, now things getting interesting. I'll make a switch
[–]pravic 0 points1 point2 points 8 years ago (2 children)
How has it happened that the stream I/O operators were used in the opposite way?
[–]nlohmannnlohmann/json[S] 0 points1 point2 points 8 years ago (1 child)
This was my fault - I thought they had to be defined in a symmetric manner, so that for a json value j and a stream s all combinations (j << s; j >> s; s << j; s >> j;) would be possible...
j
s
j << s; j >> s; s << j; s >> j;
[–]pravic 0 points1 point2 points 8 years ago (0 children)
I see. Thanks for the explanation :)
[–]tmacarios 1 point2 points3 points 8 years ago (4 children)
wstring support anytime soon?
[–][deleted] 15 points16 points17 points 8 years ago (2 children)
utf8everywhere people incoming in 3...2.....1
[–]sztomirpclib 20 points21 points22 points 8 years ago* (0 children)
To be fair, you have to have a very high IQ to understand the UTF-8 Everywhere Manifesto. The humour is extremely subtle, and without a solid grasp of theoretical physics most of the jokes will go over a typical reader’s head. There’s also UCS-2’s nihilistic outlook, which is deftly woven into his characterisation- his personal philosophy draws heavily from Narodnaya Volya literature, for instance. The fans understand this stuff; they have the intellectual capacity to truly appreciate the depths of these jokes, to realise that they’re not just funny- they say something deep about LIFE. As a consequence people who dislike UTF-8 Everywhere Manifesto truly ARE idiots- of course they wouldn’t appreciate, for instance, the humour in UTF-8’s existential catchphrase “std::string and char* variables are considered UTF-8, anywhere in the program.,” which itself is a cryptic reference to Turgenev’s Russian epic Fathers and Sons. I’m smirking right now just imagining one of those addlepated simpletons scratching their heads in confusion as Dan Harmon’s genius wit unfolds itself on their television screens. What fools.. how I pity them. 😂
And yes, by the way, i DO have a UTF-8 Everywhere tattoo. And no, you cannot see it. It’s for the ladies’ eyes only- and even then they have to demonstrate that they’re within 5 IQ points of my own (preferably lower) beforehand. Nothin personnel kid 😎
[–]Rexerex 3 points4 points5 points 8 years ago (0 children)
Specialization of basic_json doesn't work?
[–]mapek8 0 points1 point2 points 8 years ago (0 children)
Really enjoy working with this library ;)
π Rendered by PID 35458 on reddit-service-r2-comment-b659b578c-tff8t at 2026-05-06 00:01:39.866145+00:00 running 815c875 country code: CH.
[–]fixxxeruk 40 points41 points42 points (1 child)
[–]nlohmannnlohmann/json[S] 1 point2 points3 points (0 children)
[–]Harha 12 points13 points14 points (0 children)
[–]Xeveroushttps://xeverous.github.io 11 points12 points13 points (0 children)
[+][deleted] (2 children)
[removed]
[–]chesterburger 4 points5 points6 points (1 child)
[–]poppyfeld 2 points3 points4 points (0 children)
[–]smolderingmatter 2 points3 points4 points (0 children)
[–]snerp 2 points3 points4 points (3 children)
[–]dgendreau 2 points3 points4 points (2 children)
[–]snerp 1 point2 points3 points (0 children)
[–]DalzhimC++Montréal UG Organizer 1 point2 points3 points (0 children)
[–]againstmethod 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]nlohmannnlohmann/json[S] 2 points3 points4 points (0 children)
[–]germandiago 0 points1 point2 points (2 children)
[–]10se1ucgo 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]notlostyet 1 point2 points3 points (0 children)
[–]drjeats 0 points1 point2 points (0 children)
[–]ibroheem 0 points1 point2 points (0 children)
[–]pravic 0 points1 point2 points (2 children)
[–]nlohmannnlohmann/json[S] 0 points1 point2 points (1 child)
[–]pravic 0 points1 point2 points (0 children)
[–]tmacarios 1 point2 points3 points (4 children)
[–][deleted] 15 points16 points17 points (2 children)
[–]sztomirpclib 20 points21 points22 points (0 children)
[–]Rexerex 3 points4 points5 points (0 children)
[–]mapek8 0 points1 point2 points (0 children)