Function parse

Source
pub fn parse(input: &str) -> Result<Json, ParseError>
Expand description

Reads a whole document and returns its root value.

The entire input must be consumed: anything after the root value is an error, so a truncated or doubly written catalog is caught rather than half loaded. Malformed Unicode, non-finite numbers and more than 128 nested containers are rejected. Parse failures include a byte offset.

let value = aede_core::json::parse(r#"{"count":3}"#)?;
assert_eq!(value.field_u32("count"), Some(3));
assert!(aede_core::json::parse("01").is_err());