Reading only JSON from begin+end containers #4641
AbitTheGray
started this conversation in
Ideas
Replies: 1 comment
-
Internally, there is a flag to the parser to say whether or not it is an error to have leftover data at the end. This is set to true when using the parse function and false when using the streams. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have found a major difference between
nlohmann::basic_json::parse
andnlohmann::operator>>(basic_json)
- it is not possible to parse only the JSON from a container.When reading from the stream, it stops after the JSON is completed but with
parse
, it says "expected end of input".Is there a way (callback, toggle...) to say "read just the valid JSON and give me iterator/pointer after it" ?
I've started it as discussion as I am not sure if there is someone else who would like this functionality as, as shown below, it can be done with little code around it.
Example
Beta Was this translation helpful? Give feedback.
All reactions