1use c12_parser::{FormatOptions, parse_json, stringify_json};
4use serde_json::Value;
5
6fn main() {
7 let text = r#" { "a": 1, "b": [2, 3] } "#;
8
9 let formatted = parse_json::<Value>(text, None).expect("parse");
10 println!("Parsed: {:?}", formatted.value);
11
12 let out = stringify_json(&formatted, None).expect("stringify");
13 println!("Stringify (preserves outer whitespace): {:?}", out);
14
15 let mut opts = FormatOptions::default();
16 opts.indent = Some(4);
17 let out_indent = stringify_json(&formatted, Some(opts)).expect("stringify");
18 println!("Stringify (indent=4):\n{}", out_indent);
19}