Trait serde_json::value::ToJson
[−]
[src]
pub trait ToJson { fn to_json(&self) -> Result<Value, Error>; }
Representation of any serializable data as a serde_json::Value
.
Required Methods
fn to_json(&self) -> Result<Value, Error>
Represent self
as a serde_json::Value
. Note that Value
is not a
JSON string. If you need a string, use serde_json::to_string
instead.
This conversion can fail if T
's implementation of Serialize
decides
to fail, or if T
contains a map with non-string keys.