json-minify
1.1.2
dotnet tool install --global json-minify --version 1.1.2
dotnet new tool-manifest
dotnet tool install --local json-minify --version 1.1.2
#tool dotnet:?package=json-minify&version=1.1.2
nuke :add-package json-minify --version 1.1.2
json-minify
A command-line utility to help developers minify JSON files by removing whitespace and formatting, reducing file size (typically 30%) for production use.
Run json-minify in your favorite console window.
Features
- Minify a single JSON file or all JSON files in a folder
- Outputs minified files with
.min.jsonextension - Specify a custom target folder for output files
- Validates JSON syntax during minification
Installation
Install globally using the .NET CLI:
dotnet tool install --global json-minify
To update the tool:
dotnet tool update --global json-minify
Usage
USAGE:
json-minify <FILEPATH> [OPTIONS] [COMMAND]
ARGUMENTS:
<FILEPATH> The fully qualified file path for the target json file to minify
OPTIONS:
-h, --help Prints help information
-t, --target-folder The target folder where the minified file will be written. Defaults to the current folder
COMMANDS:
file <FILEPATH> Default command that minifies the specified json file
folder <FOLDERPATH> Command that minifies all of the json files in the specified folder
File Command Options
USAGE:
json-minify file <FILEPATH> [OPTIONS]
ARGUMENTS:
<FILEPATH> The fully qualified file path for the target json file to minify
OPTIONS:
-h, --help Prints help information
-t, --target-folder <FOLDER> The target folder where the minified file will be written.
Defaults to the current folder.
Folder Command Options
USAGE:
json-minify folder <FOLDERPATH> [OPTIONS]
ARGUMENTS:
<FOLDERPATH> The fully qualified target directory/folder path to search for json files to minify
OPTIONS:
-h, --help Prints help information
-t, --target-folder <FOLDER> The target folder where the minified files will be written.
Defaults to the current folder.
Examples
Minify a single JSON file (file is the default command used when no command is specified):
json-minify .\config.json
Minify a JSON file and output to a specific folder:
json-minify file .\config.json --target-folder .\dist
Minify all JSON files in a folder:
json-minify folder .\data
Minify all JSON files in a folder and output to a build directory:
json-minify folder .\data -t .\build\output
Output
- Input:
config.json→ Output:config.min.json - Input:
data.json→ Output:data.min.json
Feedback
If you use this tool and have any feedback, bugs, or suggestions, please file them in the Issues section of this repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.2 | 88 | 2/13/2026 |
Initial minification tool that supports minifying single JSON file or all JSON files in a particular folder.