pub fn json_token_iter(input: &[u8]) -> JsonTokenIterator<'_> 
Expand description

JSON token parser as a Rust iterator

This parser will parse and yield exactly one Token per iterator next() call. Validation is done on the fly, so it is possible for it to parse an invalid JSON document until it gets to the first Error.

JSON string values are left escaped in the Token::ValueString as an EscapedStr, which is a new type around a slice of original input bytes so that the caller can decide when to unescape and allocate into a String.

The parser will accept multiple valid JSON values. For example, b"null true" will yield ValueNull and ValueTrue. It is the responsibility of the caller to handle this for their use-case.