Function binary_extract::extract

source ·
pub fn extract(s: &str, key: &str) -> Result<JsonValue, ExtractError>
Expand description

Extract a value from a json string without parsing the whole thing.

With the case from benches/json.rs, this is ~3x faster than using the json crate directly.

Examples

let value = binary_extract::extract(r#"{"foo": "bar"}"#, "foo").unwrap();
assert_eq!(value, "bar");