← 返回
开发者工具 中文

Skill 3

Swiss-army knife for JSON files. Pretty-print, validate, minify, sort keys, and query with dot-notation paths. Zero dependencies.
JSON文件多功能工具。支持格式化、验证、压缩、键排序及点记法路径查询。零依赖。
claudiodrusus claudiodrusus 来源
开发者工具 clawhub v1.0.0 1 版本 99875.9 Key: 无需
★ 0
Stars
📥 805
下载
💾 4
安装
1
版本
#latest

概述

JSON Toolkit

A zero-dependency Python utility for working with JSON data. Validates, formats, minifies, queries, and inspects JSON files — all with Python's standard library.

Features

  • Pretty-print with configurable indentation (2, 4, or any number of spaces)
  • Minify JSON to reduce file size for APIs and storage
  • Validate JSON and get structural stats (type, key count, size)
  • Query nested data with dot-notation paths including array indices
  • Sort keys alphabetically for deterministic output and easier diffs
  • Stdin support for use in shell pipelines with other tools

Usage Examples

Pretty-print a JSON file:

python main.py data.json

Validate without output:

python main.py config.json --validate
# ✓ Valid JSON
#   Type: object (12 keys)
#   Size: 4832 bytes

Query a nested value:

python main.py users.json --query data.users.0.name
# "Alice"

Minify for production:

python main.py config.json --minify -o config.min.json

Sort keys for consistent diffs:

python main.py package.json --sort-keys -o package-sorted.json

Pipe from curl:

curl -s https://api.example.com/data | python main.py - --query results.0

Query Syntax

Use dot notation to navigate nested structures. Array indices are numbers:

  • name — top-level key
  • data.users — nested object key
  • data.users.0 — first element of an array
  • data.users.0.email — field of the first array element
  • config.servers.2.host — deeply nested value

Command Line Options

  • input — JSON file path, or - for stdin
  • -o, --output — Output file (defaults to stdout)
  • --indent N — Indentation spaces (default: 2)
  • --minify — Output minified JSON (no whitespace)
  • --query PATH / -q PATH — Extract a value at the given dot-notation path
  • --validate — Only validate and print stats, no output
  • --sort-keys — Sort object keys alphabetically
  • --json — (implicit) Output is always valid JSON

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 14:24 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 194 📥 67,391
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 71 📥 181,360
office-efficiency

Markdown to HTML

claudiodrusus
{"answer":"将 Markdown 转换为内嵌 CSS、样式精美的独立 HTML。完美适用于新闻简报、文档、报告及邮件模板。"}
★ 1 📥 2,140