pub trait MultilineKVStrToJson {
// Required method
fn multiline_kv_str_to_json(&self) -> Result<Value, String>;
}Required Methods§
fn multiline_kv_str_to_json(&self) -> Result<Value, String>
Implementations on Foreign Types§
Source§impl MultilineKVStrToJson for String
impl MultilineKVStrToJson for String
Source§fn multiline_kv_str_to_json(&self) -> Result<Value, String>
fn multiline_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::MultilineKVStrToJson;
let path = "data/win-systeminfo.txt";
let mut out = String::new();
{
let mut f = File::open(path).unwrap();
f.read_to_string(&mut out).unwrap();
}
let result = out.multiline_kv_str_to_json();
println!("{:#?}", result.unwrap());