Function json_with_comments::de::from_value
source · pub fn from_value<'de, T>(value: &'de Value) -> Result<T>where
T: Deserialize<'de>,
Expand description
Deserialize crate::value::JsoncValue
to T
§Example
use serde::Deserialize;
#[derive(Deserialize)]
struct Person<'a> {
name: &'a str,
age: Option<u32>,
}
let target = json_with_comments::jsonc!({"name": "John", "age": 30});
let person: Person = target.into_deserialize().unwrap();
assert!(matches!(person, Person { name: "John", age: Some(30) }));