← 返回
未分类 中文

json-formatter-pro

Format and validate JSON files with options for indentation, key sorting, input/output from files or stdin, and detailed error reporting.
格式化并校验JSON文件,支持缩进设置、键排序、文件/标准输入输出及详细错误报告。
harrylabsj harrylabsj 来源
未分类 clawhub v1.0.3 1 版本 100000 Key: 无需
★ 0
Stars
📥 496
下载
💾 0
安装
1
版本
#latest

概述

json-formatter-pro

Format and validate JSON files with pretty-printing and validation modes.

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/json_formatter.py format input.json

# Format and save to a new file
python ~/.openclaw/skills/json-formatter/json_formatter.py format input.json -o output.json

# Validate JSON syntax without formatting
python ~/.openclaw/skills/json-formatter/json_formatter.py validate input.json

# Read from stdin, format and output to stdout
cat input.json | python ~/.openclaw/skills/json-formatter/json_formatter.py format -

# Validate JSON from stdin
cat input.json | python ~/.openclaw/skills/json-formatter/json_formatter.py validate -

Options

  • format: Pretty-print JSON with proper indentation
  • validate: 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/json_formatter.py format data.json -i 4

# Format and sort keys
python ~/.openclaw/skills/json-formatter/json_formatter.py format data.json --sort-keys

# Validate a JSON file
python ~/.openclaw/skills/json-formatter/json_formatter.py validate config.json
# Output: Valid JSON or error message with line number

Exit Codes

  • 0: Success
  • 1: Invalid JSON syntax
  • 2: File not found or permission error
  • 3: Other error

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-03-30 02:04 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 42,168
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 687 📥 331,409
professional

Legal Risk Assistant

harrylabsj
China legal triage assistant. Input a contract, labor dispute facts, lawsuit-cost question, or draft legal document need
★ 0 📥 2,025