Function jsonutils::print::print_json_with_indent

source ยท
pub fn print_json_with_indent<T: Serialize>(
    value: T,
    indent: usize,
) -> Result<()>
Expand description

Pretty-print a serializable value as JSON with a custom indentation.

use jsonutils::print::print_json_with_indent;
use serde_json::json;

let json = json!({
   "name": "Alice",
   "age": 30,
   "is_student": false
});

print_json_with_indent(json, 2).unwrap();