pub fn to_string<T: ?Sized + Serialize>(value: &T) -> String
Expand description
Serialize any serializable type into a JSON string.
use miniserde::{json, Serialize};
#[derive(Serialize, Debug)]
struct Example {
code: u32,
message: String,
}
fn main() {
let example = Example {
code: 200,
message: "reminiscent of Serde".to_owned(),
};
let j = json::to_string(&example);
println!("{}", j);
}