mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2025-02-16 12:18:27 +00:00
Created description on JSON example.
Added descriptions on parsed and instantiated JSON in Rust. Also explained that by using the assert_eq macro we are ensuring equivalence.
This commit is contained in:
parent
7b88a53beb
commit
ab0c1ea8f4
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
##JSON implementation in Rust:
|
||||
|
||||
The example below shows two simple ways to embed JSON in Rust.
|
||||
The first method parses block JSON as a block using the parse method from the json crate. It then unwraps the parsed JSON.
|
||||
The second method instantiates an object as JSON using the object macro. Key value relationships are easily set using `=>`
|
||||
After demonstrating two simple ways to write JSON, the assert_eq macro ensures equivalence.
|
||||
|
||||
[![json][json-badge]][json]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue