| Crates.io | format-json |
| lib.rs | format-json |
| version | 0.1.1 |
| created_at | 2025-02-16 22:34:08.703585+00 |
| updated_at | 2025-02-19 19:35:53.123496+00 |
| description | A CLI tool for recursively formatting JSON files. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1558203 |
| size | 21,405 |
format-json is a simple and efficient tool for formatting JSON files. It recursively scans directories for files with the .json extension and automatically re-formats them to be more readable with proper indentation.
This tool is built using Rust and leverages asynchronous processing through Tokio. It utilizes several Rust crates to accomplish its tasks:
To build format-json, ensure you have Rust and Cargo installed. Then, clone the repository and run:
cargo build --release
This will compile the project in release mode.
You can run format-json either via Cargo or by using the compiled binary.
To format JSON files in the current directory:
cargo run
To specify a different directory, provide the path as an argument:
cargo run -- /path/to/directory
After building the project, the binary will be located in target/release. Run it using:
./target/release/format-json /path/to/directory
If no directory is provided, the tool will default to using the current working directory.
Run the tests with:
cargo test
The tests include a sample JSON file formatting test to ensure the tool produces the expected output.
The project leverages helper crates (xio and dset) for core functionalities, ensuring modular and maintainable code.
Contributions are welcome! Please feel free to open issues or submit pull requests if you have suggestions or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
Balazs Horvath
Thanks to the authors of the Rust crates that make this project possible!