JSON tokenizer and parser. JSON format supports following types:
Number
, translates to Rust f68
String
, translates to Rust owned String
Vec<T>
, where T
is one of the listed typesHashMap<String, T>
, where T
is one of the listed typesis defined as follows:
pub enum Json {
Null,
Bool(bool),
Number(f64),
String(String),
Array(Vec<Box<Json>>),
Object(HashMap<String, Box<Json>>),
}
This enum implements FromStr
trait and therefore can be used as follows:
let value: Json = json_string.parse::<Json>()?;
Add to your Cargo.toml
json-parser = "1"