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
[Read Me](https://github.com/bohdaq/rust-web-server/blob/main/README.md) > [Documentation](https://github.com/bohdaq/rust-web-server/tree/main/src/README.md) > JSON
JSON module is designed to convert JSON string into corresponding hierarchy of structs in Rust and vice versa.
JSON needs to be valid, the module itself is not formatter or validator. However, it will return an error if provided json string is not appropriate.
As it's up to developer to decide how to define structs, the underlying conversion is achieved by obligation for developer to implement `New`, `FromJSON` and `ToJSON` traits.
Luckily, all internal cumbersome functionally is done by JSON module, developer simply needs to define properties and invoke corresponding functions within trait implementation.
JSON module supports nested objects and arrays.
Within module itself, in a tests section, you may find examples on how to use it.
Take a look at [json array](https://github.com/bohdaq/rust-web-server/tree/main/src/json/array) module.
Take a look at [json object](https://github.com/bohdaq/rust-web-server/tree/main/src/json/object) module.
Take a look at [json property](https://github.com/bohdaq/rust-web-server/tree/main/src/json/property) module.
- ------------------