1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! # arson
//!
//! **arson** is a simple rust json library for parsing string. it has nice formatted colored output
//!
//! ## Example
//!
//! ```rust
//! use arson::{JSONError, Parser, JSON, JSON::*};
//!
//! fn main() -> Result<(), JSONError> {
//! // alternative A
//! let json_str = std::fs::read_to_string("ex.json").unwrap();
//! // alternative B
//! let json_str = r#"{
//! "name": "John Doe",
//! "age": 43,
//! "address": {
//! "street": "10 Downing Street",
//! "city": "London"
//! },
//! "phones": [
//! "+44 1234567",
//! "+44 2345678"
//! ]
//! } "#;
//!
//! // alternative 1
//! let json = json_str.parse::<JSON>().expect("Failed to parse json");
//! // alternative 2
//! let json = Parser::parse(json_str.chars())?;
//!
//! println!("{:?}", json);
//!
//! match json {
//! Array(val) => {} // Vec<JSON>
//! Object(val) => {} // HashMap<String, JSON>
//! String(val) => {} // String
//! Number(val) => {} // f64
//! Bool(val) => {} // bool
//! Null => {}
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! Output
//!
//! ```
//! {
//! "address": {
//! "city": "London",
//! "street": "10 Downing Street",
//! },
//! "name": "John Doe",
//! "age": 43,
//! "phones": [
//! +44 1234567,
//! +44 2345678,
//! ],
//! }
//! ```
pub use JSON;
pub use JSONError;
pub use Parser;