4 stable releases

2.0.0 Apr 28, 2022
1.2.0 Sep 4, 2021
1.0.1 Aug 18, 2021

#116 in Value formatting

Download history 108/week @ 2024-07-27 87/week @ 2024-08-03 62/week @ 2024-08-10 77/week @ 2024-08-17 120/week @ 2024-08-24 262/week @ 2024-08-31 120/week @ 2024-09-07 55/week @ 2024-09-14 82/week @ 2024-09-21 118/week @ 2024-09-28 44/week @ 2024-10-05 52/week @ 2024-10-12 85/week @ 2024-10-19 184/week @ 2024-10-26 106/week @ 2024-11-02 49/week @ 2024-11-09

432 downloads per month
Used in 5 crates (4 directly)

MIT license

10KB
197 lines

Extremely fast JSON formatter

jsonformat is an extremely fast JSON formatter.

It formats over 20MB of nested JSON in 60ms.

Library crate

For the library crate, look at docs.rs

Binary Install

You need Rust installed on your system
cargo install jsonformat-cli

Binary Usage

jsonformat-cli 0.2.0
Nilstrieb <nilstrieb@gmail.com>
Formats JSON extremely fast

USAGE:
    jsonformat [OPTIONS] [INPUT]

ARGS:
    <INPUT>    The input file

OPTIONS:
    -h, --help                         Print help information
    -i, --indentation <INDENTATION>    The indentation, s will replaced by a space and t by a tab.
                                       ss is the default
    -o, --output <OUTPUT>              The output file
    -V, --version                      Print version information

Reads from stdin if no file is supplied. Outputs to stdout if no output file is specified.

Error handling

jsonformat does not report malformed json - it can't even fully know whether the json is actually malformed. Malformed json is just formatted kind of incorrectly, with no data lost and no crashes. If you find one, open an issue,

How?

jsonformat does not actually parse the json, it just loops through each character and keeps track of some flags. It then copies these characters to the output buffer, adding and removing whitespace.

No runtime deps