tree: d18b92870da723ed92c44d43f8152fe185543ab8 [path history] [tgz]
  1. examples/
  2. src/
  3. tests/
  4. .cargo-checksum.json
  5. Cargo.lock
  6. Cargo.toml
  7. code-of-conduct.md
  8. CONTRIBUTING.md
  9. LICENSE
  10. README.md
  11. rustfmt.toml
third_party/rust_crates/vendor/json5format/README.md

json5format

json5format is a general purpose Rust library that formats JSON5 (a.k.a., “JSON for Humans”), preserving contextual line and block comments.

crates.io license docs.rs json5format

json5format Rust library

The json5format library includes APIs to customize the document format, with style options configurable both globally (affecting the entire document) as well as tailoring specific subsets of a target JSON5 schema. (See the Rust package documentation for more details and examples.)

formatjson5 command line tool

The json5format package also bundles an example command line tool, formatjson5, that formats JSON5 documents using a basic style with some customizations available through command line options:

$ cargo build
$ ./target/debug/examples/formatjson5 --help

formatjson5 [FLAGS] [OPTIONS] [files]...

FLAGS:
-h, --help                  Prints help information
-n, --no_trailing_commas    Suppress trailing commas (otherwise added by default)
-o, --one_element_lines     Objects or arrays with a single child should collapse to a
                            single line; no trailing comma
-r, --replace               Replace (overwrite) the input file with the formatted result
-s, --sort_arrays           Sort arrays of primitive values (string, number, boolean, or
                            null) lexicographically
-V, --version               Prints version information

OPTIONS:
-i, --indent <indent>    Indent by the given number of spaces [default: 4]

ARGS:
<files>...    Files to format (use "-" for stdin)

NOTE: This is not an officially supported Google product.