pub fn print_json<T: Serialize>(value: T) -> Result<(), Error>
Expand description
Pretty-print a serializable value as JSON with a default indentation of 4 spaces. Will returns an Error if the value cannot be serialized or if the output is not valid UTF-8.
use jsonutils::print::print_json;
use serde_json::json;
let json = json!({
"name": "Alice",
"age": 30,
"is_student": false
});
print_json(json).unwrap();