json-rust
json-rust copied to clipboard
Allow extra characters at end
It would be really helpful for my use case if there were a way to allow data after the JSON, and to report how much JSON was actually read.
For example if I have data like this:
{"type": "string", "length": 5}Hello
It would return the JSON data, plus a length of 31 (up to the }).
Looks like this would be easy something along the lines of this commit which I have not tested (or even compiled).
Bit of a weird use case!
By default, and per spec, any extra characters at the end are to be considered errors, however I think I can add that as an option with a generic on the parser.
This could also make it possible to have an iterator parser, eg. for log formats that print json objects on new lines.