IndentToJson

Trait IndentToJson 

Source
pub trait IndentToJson {
    // Required method
    fn indent_to_json(&self) -> Result<Value, String>;
}

Required Methods§

Implementations on Foreign Types§

Source§

impl IndentToJson for String

Source§

fn indent_to_json(&self) -> Result<Value, String>

Convert a well Indented String to a Json Document

§Example usage
use std::{fs::File, io::Read};
use nparse::IndentToJson;

let path = "data/dmidecode.txt";
let mut out = String::new();
{
    let mut f = File::open(path).unwrap();
    f.read_to_string(&mut out).unwrap();
}
let result = out.indent_to_json();
println!("{:#?}", result.unwrap());

Implementors§