Replies: 2 comments 1 reply
-
See |
Beta Was this translation helpful? Give feedback.
0 replies
-
I never knew about this method and didn't see it in the readme. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I like this library very much and I use it a lot.
When I use the NLOHMANN_DEFINE_TYPE_INTRUSIVE macro, I encountered some differences in usage habits.
the
NLOHMANN_DEFINE_TYPE_INTRUSIVE
implementsto_json
andfrom_json
functions.The detail of
from_json
will useNLOHMANN_JSON_FROM
the defination of
NLOHMANN_JSON_FROM
isif the json string don't have the key, it will throw an exception and terminal the program.
In my use case, if the key-value pair doesn't exist, you should ignore it instead of terminating the program.so I think it would be better to ignore the key-value pairs:
@nlohmann Which method is better?
Beta Was this translation helpful? Give feedback.
All reactions