pub fn from_str<T>(json: &str) -> Result<T, JsonParseErrorWithContext<'_>>where
T: Facet,Expand description
Deserializes a JSON string into a value of type T that implements Facet.
This function takes a JSON string representation and converts it into a Rust
value of the specified type T. The type must implement the Facet trait
to provide the necessary type information for deserialization.
§Parameters
json- A string slice containing the JSON to deserialize
§Returns
Ok(T)- The successfully deserialized valueErr(JsonParseErrorWithContext)- An error with context if deserialization fails
§Example
let json = r#"{"name":"Alice","age":30}"#;
let person: Person = facet_json_read::from_str(json).unwrap();