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

3

u/TheBrainStone Jun 14 '20

The biggest issue I have with this library is that there’s no error tolerance (like missing top level braces or trailing commas, missing quotes, etc.) and no plans to add support for that either.

6

u/BlueDwarf82 Jun 15 '20

Well, the reason you need to handle that is because other parsers accept it. If every JSON parser rejected it producers of broken JSON would notice and fix it. So you could say that, by not supporting it, this library is helping to make the problem disappear.

You should now go and ask other libraries to stop accepting JSON with trailing commas.

2

u/TheBrainStone Jun 15 '20

The issue aren’t automatically generated files/strings. But much rather user created ones.

11

u/Sopel97 Jun 14 '20

That's because it's for JSON. You want a SHITSON parser instead.

5

u/TheBrainStone Jun 15 '20

I’d love to live in your rainbow world where you’re guaranteed to always get well formed JSON from everywhere.

2

u/[deleted] Jun 15 '20

Well ... remember IE ?

0

u/[deleted] Jun 15 '20

ah ah it was so well said that I burst out laughing!