pub trait ToJson: Serialize {
    fn to_json(&self) -> Result<String, Error> { ... }
    fn to_json_vec(&self) -> Result<Vec<u8, Global>, Error> { ... }
    fn to_json_value(&self) -> Result<Value, Error> { ... }
    fn to_json_pretty(&self) -> Result<String, Error> { ... }
    fn to_jcs(&self) -> Result<Vec<u8, Global>, Error> { ... }
}
Expand description

A convenience-trait for types that can be serialized as JSON.

Provided Methods

Serialize self as a string of JSON.

Serialize self as a JSON byte vector.

Serialize self as a [serde_json::Value].

Serialize self as a pretty-printed string of JSON.

Serialize self as a JSON byte vector, normalized using JSON Canonicalization Scheme (JCS).

Implementors