c12-parser 1.1.0

Toolbox for parsing and stringifying various formats, including JSON, JSON5, JSONC, INI, TOML, and YAML.
Documentation
//! Example: parse YAML and stringify with outer whitespace preserved.

use c12_parser::{parse_yaml, stringify_yaml};
use serde_json::Value;

fn main() {
    let text = r#"

name: c12-parser
version: 1.0.0
keywords:
  - config
  - parser
"#;

    let formatted = parse_yaml::<Value>(text, None).expect("parse");
    println!(
        "Parsed: {} {}",
        formatted.value["name"], formatted.value["version"]
    );
    println!("Keywords: {:?}", formatted.value["keywords"]);

    let out = stringify_yaml(&formatted, None).expect("stringify");
    println!("Stringify:\n{}", out);
}