json_cleaner

Crates.iojson_cleaner
lib.rsjson_cleaner
version0.1.4
created_at2025-07-26 15:13:00.097321+00
updated_at2025-07-26 15:18:31.596099+00
descriptionA CLI tool to clean JSON files by removing null and empty values.
homepagehttps://github.com/MaloWinrhy/json_cleaner
repositoryhttps://github.com/MaloWinrhy/json_cleaner
max_upload_size
id1769218
size21,370
Malo "Winrhy" Henry (MaloWinrhy)

documentation

https://docs.rs/json_cleaner

README

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.

Commit count: 0

cargo fmt