360 Secure SkillHub
360 安全技能中心

Jsonpretty

这是无依赖的纯Python JSON工具,核心功能含格式化(支持紧凑、排序)、语法验证、点符号查询(兼容数组索引)、扁平嵌套结构、生成结构统计(键数、深度等)。支持从文件或标准输入读取数据,适用于调试JSON、提取字段、统计特征等场景,输出对应处理结果或统计信息。

rogue-agent1
rogue-agent1
热度 54.86
最近更新 2026-05-11 17:37:27
分类:效率依赖:代码执行应用场景:数据处理 / 文件转换

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add jsonpretty
Metadata
name
jsonpretty
description
Format, validate, query, flatten, and analyze JSON data. Use when asked to pretty-print JSON, validate JSON syntax, query nested JSON with dot-notation, flatten nested structures, get JSON statistics, or compact JSON output. Reads from files or stdin pipe. Zero dependencies — pure Python.

jsonpretty 📋

JSON swiss army knife — format, validate, query, flatten, stats.

Commands

# Pretty-print (from file or stdin)
python3 scripts/jsonpretty.py data.json
echo '{"a":1}' | python3 scripts/jsonpretty.py

# Validate JSON
python3 scripts/jsonpretty.py --validate data.json

# Query with dot-notation
echo '{"user":{"name":"Rogue"}}' | python3 scripts/jsonpretty.py -q "user.name"

# Flatten nested JSON
cat data.json | python3 scripts/jsonpretty.py --flat

# Structure stats (key count, depth, types, size)
python3 scripts/jsonpretty.py --stats data.json

# Compact output (minify)
python3 scripts/jsonpretty.py --compact data.json

# Sort keys
python3 scripts/jsonpretty.py --sort data.json

Features

  • Pretty-print with 2-space indent (default)
  • JSON validation with error messages
  • Dot-notation querying (supports array indices: key[0].sub)
  • Flatten nested objects to key.subkey = value pairs
  • Structure statistics: key count, nesting depth, type distribution, byte size
  • Compact/minify mode
  • Sorted key output
  • Reads from file or stdin