pub fn to_json_string(peek: Peek<'_>, indent: bool) -> String
Expand description
Serializes any Facet type to JSON and returns it as a String
ยงExample
use facet::Facet;
use facet_json_write::to_json_string;
use facet_peek::Peek;
#[derive(facet::Facet)]
struct Foo {
bar: String,
baz: u32,
}
let foo = Foo {
bar: "Hello, World!".to_string(),
baz: 42,
};
let foo = Peek::new(&foo);
println!("{}", to_json_string(foo, true));