Function serde_json::to_value
[−]
[src]
pub fn to_value<T>(value: T) -> Result<Value, Error> where T: SerializeConvert a T into serde_json::Value which is an enum that can represent
any valid JSON data.
This conversion can fail if T's implementation of Serialize decides to
fail, or if T contains a map with non-string keys.
let val = serde_json::to_value("s").unwrap(); assert_eq!(val, Value::String("s".to_owned()));