0.8.8
This is a patch release that adds a take_string
method to JsonValue
:
Checks that self is a string, returns an owned Rust String
, leaving
Null
in it's place.
This is the cheapest way to obtain an owned String
from JSON, as no
extra heap allocation is performend.
let mut data = array!["Hello", "World"];
let owned = data[0].take_string().expect("Should be a string");
assert_eq!(owned, "Hello");
assert!(data[0].is_null());