Also see: * https: https://crates.io/crates/colored_json
Add it to your project:
~~~toml [dependencies] colored_json = "0.1" ~~~
And then color your JSON output:
~~~rust use coloredjson::tocolored_json;
use serdejson::value::Value; use serdejson::error;
pub fn displayjsonvalue(value: &Value) -> std::result::Result<(), error::Error> {
println!("{}", to_colored_json(value)?);
Ok(())
} ~~~
Or directly write it out:
~~~rust let mut out = stdout();
{ let mut out = out.lock(); writecoloredjson(value, & mut out)? }
out.flush()?; ~~~