json_cleaner 0.1.4

A CLI tool to clean JSON files by removing null and empty values.
json_cleaner-0.1.4 is not a library.

json_cleaner

License: MIT

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.


Features

  • Recursively removes:
    • null values
    • 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

Installation

Install directly from crates.io:

cargo install json_cleaner

Usage

Basic usage:

json_cleaner --input input.json

With output written to another file:

json_cleaner --input input.json --output cleaned.json

Overwrite the original file in place:

json_cleaner --input input.json --in-place

Display help:

json_cleaner --help

Example

Input (example.json):

{
  "name": "",
  "age": null,
  "bio": "",
  "address": {
    "city": "Paris",
    "zip": null,
    "extra": {}
  },
  "tags": [],
  "projects": ["EcoWeave"]
}

Output:

{
  "address": {
    "city": "Paris"
  },
  "projects": [
    "EcoWeave"
  ]
}

License

This project is licensed under the MIT License.