Available on crate feature
json only.Expand description
Automatic JSON (de)serialization support.
See Json for details.
§Enabling
This module is only available when the json feature is enabled. Enable it
in Cargo.toml as follows:
[dependencies.rocket]
version = "0.6.0-dev"
features = ["json"]§Testing
The LocalRequest and LocalResponse types provide json() and
into_json() methods to create a request with serialized JSON and
deserialize a response as JSON, respectively.
Macros§
- json
nightly - A macro to create ad-hoc JSON serializable values using JSON syntax.
Structs§
- Json
- The JSON guard: easily consume and return JSON.
Enums§
- Error
- Error returned by the
Jsonguard when JSON deserialization fails. - Value
- An arbitrary JSON value as returned by
json!.
Functions§
- from_
slice - Deserialize an instance of type
Tfrom bytes of JSON text. - from_
str - Deserialize an instance of type
Tfrom a string of JSON text. - from_
value - Interpret a
Valueas an instance of typeT. - to_
pretty_ string - Serialize a
Tinto a JSON string with “pretty” formatted representation. - to_
string - Serialize a
Tinto a JSON string with compact representation. - to_
value - Convert a
Tinto aValue, an opaque value representing JSON data.