json-parser

Crates.iojson-parser
lib.rsjson-parser
version1.0.2
sourcesrc
created_at2019-07-06 11:03:22.174492
updated_at2019-07-06 13:05:27.781425
descriptionJSON parser
homepagehttps://github.com/venil7/json_parser/blob/master/README.md
repositoryhttps://github.com/venil7/json_parser
max_upload_size
id147094
size13,248
Art Deineka (venil7)

documentation

https://github.com/venil7/json_parser/blob/master/README.md

README

json-parser

JSON tokenizer and parser. JSON format supports following types:

  • Number, translates to Rust f68
  • String, translates to Rust owned String
  • Null, doesnt have a direct translation in Rust, indicates absence of value
  • Array, roughly tranlates to Vec<T>, where T is one of the listed types
  • Object, roughly translates to HashMap<String, T>, where T is one of the listed types

JSON value

is 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>()?;

install

Add to your Cargo.toml

json-parser = "1"
Commit count: 11

cargo fmt