-
Is there any way to tell Jsoncons to ignore those commas? I have no control over the JSON file, that's why I'm asking. Simply catching the exception and trying to call next on the cursor again, does not work because it does not progress and will cause an infinite loop. My code looks somewhat like this: readArray( const jsoncons::json_stream_cursor& cursor )
{
while ( !cursor.done() && ( cursor.current().event_type() != jsoncons::staj_event_type::end_array ) ) {
try {
cursor.next();
} catch ( const jsoncons::json_exception& exception ) {
std::cerr << "Got exception: " << exception.what() << "\n";
continue;
}
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
mxmlnkn
Nov 11, 2022
Replies: 1 comment
-
A grep search for |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mxmlnkn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A grep search for
extra_comma
lead me to error_recovery_tests.cpp, which shows exactly that usecase andjson_cursor
also takes an error handler in its constructor, so I got it working with that. 🎉