pub fn validate<R: Read>(reader: R) -> Result<(JsonType, usize, usize)>
Expand description
A convenient method to check and consume JSON from a stream of bytes.
ยงExample
use turbo_json_checker::{validate, JsonType};
let text = r#""I am a simple string!""#;
let bytes = text.as_bytes();
let json_type = validate(bytes)?;
assert_eq!(json_type, (JsonType::String, 0, text.len() - 1));