360 Secure SkillHub
360 安全技能中心

JSON Formatter

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

分类:效率
terrycarter1985
terrycarter1985
热度 4.52
最近更新 2026-09-16 01:29:19

安装

发给 Agent
帮我安装这个技能: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