360 Secure SkillHub
360 安全技能中心

JSON Formatter

通过 Python 脚本对 JSON 文件或 stdin 进行美化、压缩和语法校验,支持指定缩进;不涉及外部服务或复杂数据处理。

terrycarter1985
terrycarter1985
热度 26.78
最近更新 2026-09-16 01:29:19
分类:效率依赖:代码执行 / 读写文件应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add terrycarter1985/json-formatter
Metadata
name
json-formatter
description
Format, minify, and validate JSON data. Use when you need to pretty-print JSON, compact JSON for transport, verify JSON syntax, or process JSON from files or stdin.

JSON Formatter

Format, minify, and validate JSON with a single script.

Quick Reference

# Format (pretty-print)
python3 scripts/json_tool.py format [file] [--indent 2]

# Minify (remove whitespace)
python3 scripts/json_tool.py minify [file]

# Validate (check syntax only)
python3 scripts/json_tool.py validate [file]

If file is omitted, reads from stdin.

Examples

# Format a file
python3 scripts/json_tool.py format config.json --indent 4

# Minify a file and save
python3 scripts/json_tool.py minify data.json > min.json

# Validate stdin
echo '{"a":1}' | python3 scripts/json_tool.py validate

# Pipe through format
cat api-response.json | python3 scripts/json_tool.py format