Logo by Misiasart
Thanks to all individual and corporate sponsors, without whom this work could not exist:
JSON serialization and deserialization for facet.
Usage
Serialization Example
use Facet;
use Peek;
use to_json_string;
// Create a struct to serialize
let person = Person ;
// Create a Peek object from the struct
let peek = new;
// Serialize to JSON (true = pretty-print)
let json = to_json_string;
println!;
// Output:
// {
// "name": "Alice",
// "age": 30
// }
Deserialization Example
use Facet;
use from_str;
// JSON string to deserialize
let json = r#"{"name":"Bob","age":25}"#;
// Deserialize the JSON to a Person struct
let person: Person = from_str.unwrap;
println!;
// Output: Person { name: "Bob", age: 25 }