Trait identity_core::convert::ToJson
source · pub trait ToJson: Serialize + Sized {
// Provided methods
fn to_json(&self) -> Result<String> { ... }
fn to_json_vec(&self) -> Result<Vec<u8>> { ... }
fn to_json_value(&self) -> Result<Value> { ... }
fn to_json_pretty(&self) -> Result<String> { ... }
fn to_jcs(&self) -> Result<Vec<u8>> { ... }
}
Expand description
A convenience-trait for types that can be serialized as JSON.
Provided Methods§
sourcefn to_json_vec(&self) -> Result<Vec<u8>>
fn to_json_vec(&self) -> Result<Vec<u8>>
Serialize self
as a JSON byte vector.
sourcefn to_json_value(&self) -> Result<Value>
fn to_json_value(&self) -> Result<Value>
Serialize self
as a serde_json::Value
.
sourcefn to_json_pretty(&self) -> Result<String>
fn to_json_pretty(&self) -> Result<String>
Serialize self
as a pretty-printed string of JSON.