Command line app to deep sort JSON files.
roast is an implementation of codesen/jsonsort-cli written in Rust using serde.
Download the latest build for your platform from Releases.
Then simply drop the executable into a location in your PATH.
Verify the checksum of the archive against the .sha256 hash file included on the Release page.
# Linux
sha256sum roast-Linux-x86_64.tar.gz
# MacOS
shasum -a 256 roast-macOS-arm64.tar.gz
# Windows
Get-FileHash -Algorithm SHA256 -Path roast-Windows-x86_64.zipThe Release Action will also log the checksum for each platform job, e.g.
---- SHA256 hash of roast-Windows-x86_64.zip ----
3900F626A25D03E557B57E1E60C6B8304634C1B8C8680193F858017360ADB7AB
MacOS Gatekeeper will prevent you from running the binary from the Releases page. This is because I don't have $99 a year to throw away on the Apple Developer Program for my cli tool with no users.
Either trust me and ignore the warning or clone the project and build it yourself (rust toolchain required):
cargo build$ roast file1.json folder1/folder2/**/*.* folder3 -s
$ roast -t -n -s *
$ roast -s yourspecialfolder
$ roast -v
$ roast --version
$ roast -h
$ roast --helpThe following will be not be processed:
node_modules/package.jsonpackage_lock.jsonpackage-lock.jsonnpm-debug.lognpm-shrinkwrap.jsonconfig.gypi.lock-wscript.DS_Store.svn/CVS/
Use roast --help to list available flags.
| short | long | description |
|---|---|---|
| -a | --arrays | Also sort any arrays if they contain only string elements |
| -d | --dry | Only list all the files to be processed |
| -g | --git | Sort any JSON files tracked by git, that have a modified status. Will not modify any untracked, staged, or ignored files |
| -i | --indentationCount | How many spaces/tabs to use (default: 2 -> spaces, 1 -> tabs) |
| -l | --lineEnding | Set to "cr", "crlf" or "lf". Otherwise, the original line ending of the file is used |
| --silent | Suppress output | |
| -s | --spaces | Use spaces for JSON file indentation (default uses tabs) |
| -v | --verbose | Enable verbose output for debugging |
| -h | --help | Print help |
| -V | --version | Print version |
See enhancement Issues