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
//! yan_json helps you handling json serialization and deserialization.
//!
//! # Expamples
//! ```
//! use yan_json::prelude::*;
//!
//! // deserialize like this:
//! let api_data_raw = r#"{"data": ["this", "is", "data"], "time in ms": 100}"#;
//! let api_data_json = JsonNode::parse(api_data_raw).unwrap();
//! assert_eq!(api_data_json, json!({
//! "data": ["this", "is", "data"],
//! "time in ms": 100
//! }));
//!
//! // serialize like this:
//! let response_json = json!({
//! "response": "this is a response",
//! "valid": true,
//! "error": null
//! });
//! let response_raw = response_json.to_string();
//! assert_eq!(JsonNode::parse(&response_raw), Some(response_json));
//! ```
/// this module to simplify the process of importing stuff from yan_json
/// it's intended to be used like this:
/// ```
/// use yan_json::prelude::*;
/// ```
use *;
/// this struct represents a json node use to manipulate json.
/// Because it implements Display, you can serialize it by calling ```.to_string()```