This fixes a bug where serde would be unable to deserialize JSON objects with nested records.
This happened because any encounter of } would not be read by the parser (it only peeked at the value), which causes it to speedrun to the end of the object.
I adjusted the final test to have a nested record instead, but basically, before this PR:
Would never parse "age": 28 , resulting in Missing_field errors.
Now Json.Parser.read_object_end is called to read the }, and the Yojson.End_of_object error raised when the end of an object is encountered is handled by ignoring it (as it is expected state).
This fixes a bug where
serde
would be unable to deserialize JSON objects with nested records.This happened because any encounter of
}
would not be read by the parser (it only peeked at the value), which causes it to speedrun to the end of the object.I adjusted the final test to have a nested record instead, but basically, before this PR:
Would never parse
"age": 28
, resulting inMissing_field
errors.Now
Json.Parser.read_object_end
is called to read the}
, and theYojson.End_of_object
error raised when the end of an object is encountered is handled by ignoring it (as it is expected state).