Module json

Source
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
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 Json guard when JSON deserialization fails.
Value
An arbitrary JSON value as returned by json!.

Functions§

from_slice
Deserialize an instance of type T from bytes of JSON text.
from_str
Deserialize an instance of type T from a string of JSON text.
from_value
Interpret a Value as an instance of type T.
to_pretty_string
Serialize a T into a JSON string with “pretty” formatted representation.
to_string
Serialize a T into a JSON string with compact representation.
to_value
Convert a T into a Value, an opaque value representing JSON data.