json_cleaner is a simple and efficient command-line tool written in Rust that removes null, empty strings (""), empty arrays ([]), and empty objects ({}) from JSON files.
This tool is built for developers who want to clean up noisy JSON data without writing custom scripts.
- Recursively removes:
nullvalues- Empty strings
- Empty arrays
- Empty objects
- Reads JSON from a file
- Optionally writes output to a file or overwrites the input
- Outputs formatted (pretty-printed) JSON
- Lightweight and fast
Install directly from crates.io:
cargo install json_cleanerBasic usage:
json_cleaner --input input.jsonWith output written to another file:
json_cleaner --input input.json --output cleaned.jsonOverwrite the original file in place:
json_cleaner --input input.json --in-placeDisplay help:
json_cleaner --help{
"name": "",
"age": null,
"bio": "",
"address": {
"city": "Paris",
"zip": null,
"extra": {}
},
"tags": [],
"projects": ["EcoWeave"]
}{
"address": {
"city": "Paris"
},
"projects": [
"EcoWeave"
]
}This project is licensed under the MIT License.