ppj-0.1.1 is not a library.
PPJ
A simple Rust CLI that prettifies JSON.
Getting Started
- Install:
cargo install ppj - Build:
cargo build - Run:
ppj - Test:
cargo test
Usage
ppj accepts a JSON string as a positional argument, or reads JSON from stdin when no positional input is provided. It outputs pretty-printed JSON to stdout by default.
Basic
- From a positional argument:
ppj '{"key":"value","nums":[1,2]}'
- From stdin:
echo '{"key":"value","nums":[1,2]}' | ppj
Output to file
Use -o/--out to write the prettified JSON to a file. Parent directories are created if they don’t exist.
ppj '{"key":"value"}' -o output.json
Print and write
Use -p/--print to also print to stdout when writing to a file.
ppj '{"key":"value"}' -o output.json -p
Options
-o, --out <DIR>: Output file path.-p, --print: Print prettified JSON to stdout even when--outis set.
License
MIT