pub fn parse(text: &str) -> Result<Value<'_>, Error>Expand description
Parses one JSON document with the default Limits, refusing duplicate
keys.
The result borrows from text: strings without escapes and all numbers are
slices of it. Call Value::into_owned to keep the value longer than the
text. To change a budget or the duplicate-key policy, use Parser.
§Errors
The first syntax error or exceeded budget, at its byte offset. See
ErrorKind for every case.
§Examples
use jsonx_lib::{parse, ErrorKind};
let v = parse(r#"{"list": [1, 2.5, "three"]}"#)?;
assert_eq!(v["list"][2], "three");
let err = parse(r#"{"a": tru}"#).unwrap_err();
assert_eq!(err.kind(), ErrorKind::InvalidLiteral);
assert_eq!(err.offset(), 9);