#json #serde-json #color #console #ansi

termcolor-json

A library for writing colored JSON output to a termcolor terminal

6 releases (1 stable)

1.0.0 Jan 1, 2022
0.1.4 Sep 23, 2021
0.1.2 Aug 15, 2021

#662 in Command-line interface

37 downloads per month
Used in ryan-cli

MIT/Apache

23KB
519 lines

Crates.io Docs.rs

termcolor-json

A library for writing colored JSON output to a termcolor terminal.

let stdout = StandardStream::stdout(ColorChoice::Auto);

termcolor_json::to_writer(
    &mut stdout.lock(),
    &serde_json::json!({
        "string": "value",
        "number": 123,
        "bool": true,
        "null": null,
    }),
)?;

Sample image

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.4–1MB
~19K SLoC