Permalink to InstallationInstallation
Use it
Once installed, call jsoncomb in the terminal with file paths, folder paths, or quoted glob patterns, for example:
$ jsoncomb --normalise "first.json" "second.json"
$ jsoncomb -n "data/**/index.json" -i "content.optional"
$ jsoncomb -n "**/*.json" -t
$ jsoncomb -v
$ jsoncomb --version
$ jsoncomb -h
$ jsoncomb --help
API — flags
| short | long | description |
|---|---|---|
-n | ||
-n | --normalise | Normalise all files in the given set |
-i | ||
-i | --ignore | Ignore object key paths when filling placeholder values |
-t | ||
-t | --tabs | Use tabs instead of default 2 spaces for JSON indentation |
-v | ||
-v | --version | Shows the installed version of json-comb |
-h | ||
-h | --help | Shows (similar to this) help |
Normalise
$ jsoncomb --normalise "first.json" "second.json"
$ jsoncomb -n "data/**/index.json" -i "content.optional"
Normalisation adds missing keys from the combined schema to each JSON file. The matched set must contain at least two files. The --ignore option names object key paths; it does not exclude files from the matched set.
Processing errors
If normalisation fails, JSON Comb writes an [ID_3] diagnostic to standard error and exits with code 1. JSON parsing and filesystem errors include the original error message, including the affected path when available.
Normalisation updates files in place. A write failure can occur after other files have been updated; the operation does not roll back those changes.