confused of paresr callback's behavior of null object: remove or discarded? #4338
Labels
confirmed
kind: bug
state: please discuss
please discuss the issue or vote for your favorite option
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
Discussed in #4336
Originally posted by gino0717 April 8, 2024
hi sir,
I'm studying the document of Parser Callbacks
I replace some of the values to null of the example , then expect the parser would remove the object if the value is null.
the input goes like :
Both "Width" under "Image" and "Thumbnail" are null.
in version 2.1.1 which directly installed from apt-get gives the result just as I expected, both the "Width" disappear due to the null value:
but in version 3.10.5 it gives the result like:
the second "Width" in Thumbnail becomes "discarded" , and the "discarded" itself cannot be parsed if I feed the filtered json back to parser by :
json parse_again=json::parse(j_filtered.dump());
it gives
When does the parser give the null object a "discarded" value or just remove the object if filtered by the parser callback? Could I chose which behavior it acts?
here's my original code:
The text was updated successfully, but these errors were encountered: