|
19 | 19 | //! # What is JSON?
|
20 | 20 | //!
|
21 | 21 | //! JSON (JavaScript Object Notation) is a way to write data in Javascript.
|
22 |
| -//! Like XML, it allows to encode structured data in a text format that can be easily read by humans |
23 |
| -//! Its simple syntax and native compatibility with JavaScript have made it a widely used format. |
| 22 | +//! Like XML, it allows to encode structured data in a text format that can be |
| 23 | +//! easily read by humans Its simple syntax and native compatibility with |
| 24 | +//! JavaScript have made it a widely used format. |
24 | 25 | //!
|
25 |
| -//! Data types that can be encoded are JavaScript types (see the `Json` enum for more details): |
| 26 | +//! Data types that can be encoded are JavaScript types (see the `Json` enum |
| 27 | +//! for more details): |
26 | 28 | //!
|
27 | 29 | //! * `Boolean`: equivalent to rust's `bool`
|
28 | 30 | //! * `Number`: equivalent to rust's `f64`
|
29 | 31 | //! * `String`: equivalent to rust's `String`
|
30 |
| -//! * `Array`: equivalent to rust's `Vec<T>`, but also allowing objects of different types in the |
| 32 | +//! * `Array`: equivalent to rust's `Vec<T>`, but also allowing objects of |
| 33 | +//! different types in the |
31 | 34 | //! same array
|
32 |
| -//! * `Object`: equivalent to rust's `Treemap<String, json::Json>` |
| 35 | +//! * `Object`: equivalent to rust's `BTreeMap<String, json::Json>` |
33 | 36 | //! * `Null`
|
34 | 37 | //!
|
35 |
| -//! An object is a series of string keys mapping to values, in `"key": value` format. |
36 |
| -//! Arrays are enclosed in square brackets ([ ... ]) and objects in curly brackets ({ ... }). |
37 |
| -//! A simple JSON document encoding a person, his/her age, address and phone numbers could look like |
| 38 | +//! An object is a series of string keys mapping to values, in `"key": value` |
| 39 | +//! format. Arrays are enclosed in square brackets ([ ... ]) and objects in |
| 40 | +//! curly brackets ({ ... }). A simple JSON document encoding a person, |
| 41 | +//! his/her age, address and phone numbers could look like |
38 | 42 | //!
|
39 | 43 | //! ```ignore
|
40 | 44 | //! {
|
|
84 | 88 | //! extern crate "rustc-serialize" as rustc_serialize;
|
85 | 89 | //! use rustc_serialize::json;
|
86 | 90 | //!
|
87 |
| -//! // Automatically generate `RustcDecodable` and `RustcEncodable` trait implementations |
| 91 | +//! // Automatically generate `RustcDecodable` and `RustcEncodable` trait |
| 92 | +//! // implementations |
88 | 93 | //! #[derive(RustcDecodable, RustcEncodable)]
|
89 | 94 | //! pub struct TestStruct {
|
90 | 95 | //! data_int: u8,
|
|
0 commit comments