Colored JSON output for Rust
Also see:
Using
Add it to your project:
[]
= "0.1"
And then color your JSON output:
use to_colored_json;
use Value;
use error;
Or directly write it out:
let mut out = stdout;
out.flush?;
Also see:
Add it to your project:
[dependencies]
colored_json = "0.1"
And then color your JSON output:
use colored_json::to_colored_json;
use serde_json::value::Value;
use serde_json::error;
pub fn display_json_value(value: &Value) -> std::result::Result<(), error::Error> {
println!("{}", to_colored_json(value)?);
Ok(())
}
Or directly write it out:
let mut out = stdout();
{
let mut out = out.lock();
write_colored_json(value, & mut out)?
}
out.flush()?;