Trait KVStrToJson

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

Required Methods§

Implementations on Foreign Types§

Source§

impl KVStrToJson for String

Source§

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

Convert a Key Value String into a Json Document

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

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

Implementors§