Expand description
Partial JSON fixer
This is a zero dependency partial json fixer. It is very lenient, and will accept some erroneous JSON too. For example, {key: “value”} would be valid.
This can be used to parse partial json coming from a stream.
Structs§
Enums§
Functions§
- fix_
json - Takes a partial JSON string, kinda parses it and returns a complete JSON string. This function keeps the JSON as a string, goes through it and analyzes the brackets, strings, etc, to determine the missing stuff, and adds it. This approach is likely faster than the parsing appraoch (TODO: benchmmark maybe) It’s assumed that the given JSON would always be a valid incomplete JSON.
- fix_
json_ parse - Takes a partial JSON string, kinda parses it and returns a complete JSON object
The JSON is tokenized and parsed. It can then be converted to a string with
.to_string()
method