Skip to main content

parse_bytes

Function parse_bytes 

Source
pub fn parse_bytes(bytes: &[u8]) -> Result<Value<'_>, Error>
Expand description

Parses one JSON document from bytes, which must be UTF-8, with the default Limits. See Parser::parse_bytes.

§Errors

ErrorKind::InvalidUtf8 for bytes that are not UTF-8; otherwise as parse.

§Examples

let body: &[u8] = br#"{"id": 1}"#;
assert_eq!(jsonx_lib::parse_bytes(body)?["id"], 1);