Module rocket::serde::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§

  • A macro to create ad-hoc JSON serializable values using JSON syntax.

Structs§

  • The JSON guard: easily consume and return JSON.

Enums§

  • Error returned by the Json guard when JSON deserialization fails.
  • An arbitrary JSON value as returned by json!.

Functions§

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