pub fn from_value(value: &Value) -> Option<Value>Expand description
Convert a serde_json value to an immutable JSON value.
let data = r#"
{
"string": "string",
"int": 43,
"float": 5.8,
"boolean": true,
"object": {"test": "test"},
"array": [
"string",
1,
3.0,
false,
{"test": "test"},
[1]
]
}"#;
let v: Value = serde_json::from_str(data)?;
assert_eq!(Some(v.clone()), from_value(&v).and_then(|f| to_value(&f)));