Remix.run Logo
fcoury 2 hours ago

I ported it to Rust with a cli tool that allows you to format json in this format:

https://github.com/fcoury/fracturedjson-rs

https://crates.io/crates/fracturedjson

And install with:

cargo install fracturedjson

    > $ fjson --help
    Rust port of FracturedJsonJs: human-friendly JSON formatter with optional comment support.

    Usage: fjson [OPTIONS] [FILE]...

    Arguments:
      [FILE]...  Input file(s). If not specified, reads from stdin

    Options:
      -o, --output <FILE>
              Output file. If not specified, writes to stdout
      -c, --compact
              Minify output (remove all whitespace)
      -w, --max-width <MAX_WIDTH>
              Maximum line length before wrapping [default: 120]
      -i, --indent <INDENT>
              Number of spaces per indentation level [default: 4]
      -t, --tabs
              Use tabs instead of spaces for indentation
          --eol <EOL>
              Line ending style [default: lf] [possible values: lf, crlf]
          --comments <COMMENTS>
              How to handle comments in input [default: error] [possible values: error, remove, preserve]
          --trailing-commas
              Allow trailing commas in input
          --preserve-blanks
              Preserve blank lines from input
          --number-align <NUMBER_ALIGN>
              Number alignment style in arrays [default: decimal] [possible values: left, right, decimal, normalize]
          --max-inline-complexity <MAX_INLINE_COMPLEXITY>
              Maximum nesting depth for inline formatting (-1 to disable) [default: 2]
          --max-table-complexity <MAX_TABLE_COMPLEXITY>
              Maximum nesting depth for table formatting (-1 to disable) [default: 2]
          --simple-bracket-padding
              Add padding inside brackets for simple arrays/objects
          --no-nested-bracket-padding
              Disable padding inside brackets for nested arrays/objects
      -h, --help
              Print help
      -V, --version
              Print version