Validate, format, query, diff, filter, flatten, merge JSON files with dot-notation paths
编程
Json Formatter Pro
试用Format and validate JSON files with pretty-printing, indentation control, key sorting, and validation modes supporting stdin, stdout, and file I/O.
它能做什么
Format and validate JSON files with pretty-printing, indentation control, key sorting, and validation modes supporting stdin, stdout, and file I/O.
技能文档
json-formatter-pro
Usage Scenarios
Scenario 1: Format a JSON File with Proper Indentation
User input: "Format this JSON file with 4-space indentation"
Expected output: The tool reads input.json, applies 4-space indentation, and outputs the formatted JSON to stdout or a specified output file.
Scenario 2: Validate JSON Syntax
User input: "Check if my config.json has valid JSON syntax" Expected output: The tool validates the file and returns "Valid JSON" or an error message with the line number of the syntax issue.
Scenario 3: Format and Sort Keys Alphabetically
User input: "I want this JSON formatted with sorted keys" Expected output: The tool reads the JSON file, formats it with default 2-space indentation, sorts all keys alphabetically, and outputs the result.
Scenario 4: API返回的数据太乱了要格式化
User input: "后端给了一个API返回的JSON数据,字符串一长串看了头晕,帮我格式化成可读的格式,顺便检查一下语法对不对。" Expected output: 接收原始JSON字符串:1)进行语法验证并指出错误位置(如多余的逗号、未闭合的引号、不合法的数值);2)输出格式化后的JSON(缩进2空格/4空格可选);3)如果支持,还可提供JSON路径查询、键值对统计和一键复制功能。支持嵌套最大深度检测,避免循环引用导致的卡顿。
Description
A utility skill for formatting JSON files with proper indentation and validating JSON syntax. Supports reading from files or stdin, outputting to files or stdout.
Usage
# Format a JSON file (pretty-print to stdout)
python ~/.openclaw/skills/json-formatter-pro/json_formatter.py format input.json
# Format and save to a new file
python ~/.openclaw/skills/json-formatter-pro/json_formatter.py format input.json -o output.json
# Validate JSON syntax without formatting
python ~/.openclaw/skills/json-formatter-pro/json_formatter.py validate input.json
# Read from stdin, format and output to stdout
cat input.json | python ~/.openclaw/skills/json-formatter-pro/json_formatter.py format -
# Validate JSON from stdin
cat input.json | python ~/.openclaw/skills/json-formatter-pro/json_formatter.py validate -
Options
format: Pretty-print JSON with proper indentationvalidate: Check if JSON is valid without formatting output-o, --output: Specify output file (default: stdout)-i, --indent: Number of spaces for indentation (default: 2)--sort-keys: Sort JSON keys alphabetically
Examples
# Format with 4-space indentation
python ~/.openclaw/skills/json-formatter-pro/json_formatter.py format data.json -i 4
# Format and sort keys
python ~/.openclaw/skills/json-formatter-pro/json_formatter.py format data.json --sort-keys
# Validate a JSON file
python ~/.openclaw/skills/json-formatter-pro/json_formatter.py validate config.json
# Output: Valid JSON or error message with line number
Exit Codes
0: Success1: Invalid JSON syntax2: File not found or permission error3: Other error
相关技能
Convert JSON data into clean Markdown tables and reports. Use for pasted JSON, API or log output, or any batch of JSON records.
按字节、语法、类型映射、契约、尺寸五层定位并修复 JSON 问题。
轻量级JSON语法校验工具,递归扫描工作区.json文件并输出结构化错误报告。Use when 需要文件处理、文档转换、格式互转、内容提取时使用。不适用于加密文件破解。适用于独立开发者、企业团队和自动化工作流场景。支持中文交互,无需复杂配置即开即用。输出结果可直接使用,减少二次加工成本。提供结构化输出和错误处理机制。
Markdown note formatting and cleanup utility. Use when cleaning up raw notes, standardizing markdown structure, fixing heading hierarchies, or converting messy pasted text into clean, well-structured markdown documents.
Local JSON / JSONL inspection and manipulation toolkit. Inspect deeply nested structures (path tree, types, sample values per path), query with a jq-style pa...