{"id":41330,"library":"json-format-tool","title":"JSON Format Tool","description":"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.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/jinghua000/json-format-tool","tags":["javascript","json","formatter","cli"],"install":[{"cmd":"npm install json-format-tool","lang":"bash","label":"npm"},{"cmd":"yarn add json-format-tool","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-format-tool","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for deterministic key sorting in formatted output","package":"json-stable-stringify","optional":false},{"reason":"CLI argument parsing","package":"commander","optional":false}],"imports":[{"note":"Install globally, then run as command. No programmatic API available.","wrong":"npx json-format-tool <file>","symbol":"json-format-tool (CLI)","correct":"json-format-tool <file>"}],"quickstart":{"code":"npm install -g json-format-tool\necho '{\"name\":\"test\",\"age\":30}' > data.json\njson-format-tool data.json\n# Output:\n# {\n#   \"age\": 30,\n#   \"name\": \"test\"\n# }\n\n# Using stdin:\necho '{\"b\":2,\"a\":1}' | json-format-tool\n# Output:\n# {\n#   \"a\": 1,\n#   \"b\": 2\n# }\n\n# Replace file in-place:\njson-format-tool -r data.json\n\n# Custom indentation:\njson-format-tool -i 4 data.json\n\n# Disable key sorting:\njson-format-tool --no-sort data.json","lang":"javascript","description":"Demonstrates basic CLI usage: formatting a file, piping stdin, replacing in-place, custom indent, and disabling sort."},"warnings":[{"fix":"Use --no-sort option to disable key sorting.","message":"Keys are sorted alphabetically by default; this may be unexpected if preserving original order is desired.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Provide a file path or pipe JSON to stdin.","message":"CLI tool expects either a file argument or piped stdin; running without input will display help.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Install globally with `npm install -g json-format-tool`.","message":"Global installation required for command-line use; npx may not work due to lack of bin entry in some setups.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.0':25 'accept':40 'alphabet':30 'beautifi':53 'cli':6,66 'command':58 'current':21 'data':55 'default':32 'depend':62 'file':11,35 'format':2,9 'formatt':65 'in-plac':36 'indent':15 'input':42 'intern':49 'javascript':63 'json':1,10,46,54,64 'json-stable-stringifi':45 'key':16,29 'line':59 'minim':61 'option':13 'pipe':41 'place':38 'quick':52 'replac':34 'sort':17,28 'stabl':22,47 'stdin':19 'stringifi':48 'support':20 'tini':5 'tool':3,7,27 'use':44,50 'version':23","created_at":"2026-06-04T18:51:53.134337+00:00","updated_at":"2026-06-04T18:51:53.134337+00:00","problems":[{"fix":"Run `npm install -g json-format-tool`","cause":"Not installed globally or not in PATH.","error":"json-format-tool: command not found"},{"fix":"Provide a JSON file path or pipe JSON to stdin.","cause":"No file argument and no piped input provided.","error":"Cannot read property '0' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jinghua000/json-format-tool#readme","github":"https://github.com/jinghua000/json-format-tool","docs":null,"changelog":null,"pypi":null,"npm":"json-format-tool","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}