Registry / devops / json-format-tool

json-format-tool

JSON →
library0.1.0jsnpmunverified

A tiny CLI tool for formatting JSON files with options for indentation, key sorting, and stdin support. Current stable version is 0.1.0. The tool sorts keys alphabetically by default, can replace files in-place, and accepts piped input. It uses json-stable-stringify internally. Useful for quickly beautifying JSON data in the command line with minimal dependencies.

npm install json-format-tool
INSTALL
IMPORT
SIG · JSON-FORMAT-TOOL
J
json-format-tool
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

json-format-tool (CLI)
json-format-tool <file>
npx json-format-tool <file>
Install globally, then run as command. No programmatic API available.

Demonstrates basic CLI usage: formatting a file, piping stdin, replacing in-place, custom indent, and disabling sort.

npm install -g json-format-tool echo '{"name":"test","age":30}' > data.json json-format-tool data.json # Output: # { # "age": 30, # "name": "test" # } # Using stdin: echo '{"b":2,"a":1}' | json-format-tool # Output: # { # "a": 1, # "b": 2 # } # Replace file in-place: json-format-tool -r data.json # Custom indentation: json-format-tool -i 4 data.json # Disable key sorting: json-format-tool --no-sort data.json
Debug
Known issues
gotchaKeys are sorted alphabetically by default; this may be unexpected if preserving original order is desired.
fix
Use --no-sort option to disable key sorting.
affects: >=0.1.0
gotchaCLI tool expects either a file argument or piped stdin; running without input will display help.
fix
Provide a file path or pipe JSON to stdin.
affects: >=0.1.0
gotchaGlobal installation required for command-line use; npx may not work due to lack of bin entry in some setups.
fix
Install globally with `npm install -g json-format-tool`.
affects: >=0.1.0
Errors
Common errors & fixes
json-format-tool: command not found
Not installed globally or not in PATH.
fix
Run `npm install -g json-format-tool`
Cannot read property '0' of undefined
No file argument and no piped input provided.
fix
Provide a JSON file path or pipe JSON to stdin.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
json-stable-stringifyrequiredUsed for deterministic key sorting in formatted output
commanderrequiredCLI argument parsing
Agent activity
5 hits · last 30 days
node
4
Resources
json-format-tool — npm install json-format-tool · libregistry