OpenClaw JSON Toolkit v2.0
The Swiss Army knife for JSON — 6 tools, zero install, instant results.
Quick Reference
| Situation | Action | Tool |
|---|
| Messy single-line JSON from an API | Pretty-print with 2-space indent | INLINECODE0 |
| Need to minify for production |
Compress to single line |
json_format (minify) |
| Pasted JSON won't parse | Find exact error line + column |
json_validate |
| Two config files changed | See added/removed/changed paths |
json_diff |
| Need one field from 500-line JSON | Query with JSONPath expression |
json_query |
| Deeply nested keys hard to access | Flatten to dot-notation |
json_transform |
| Building an API contract | Auto-generate draft-07 schema |
json_schema_generate |
What's New in v2.0
- - :zap: CloudEdge Protocol -- All processing runs on Cloudflare's global edge network. Sub-100ms response worldwide, zero cold starts.
- :mag: DeepQuery Engine -- Full JSONPath with deep scan (
..), wildcards (*), filter expressions (?(@.price < 10)), and array slicing ([0:5]). - :shield: Schema Draft-07 Intelligence -- Auto-detects semantic formats: email, URI, date-time, IPv4, UUID. Infers
required fields and enum candidates from sample data. - :arrows_counterclockwise: StructureMorph Transform -- Recursive flatten/unflatten, key renaming with mapping objects, pick/omit projections on arbitrarily nested JSON.
MCP Quick Start
CODEBLOCK0
Add to Claude Desktop, Cursor, Windsurf, VS Code, or any MCP-compatible client. No API key needed for Free tier. Works immediately.
Detection Triggers
This skill activates when you say:
- - "format this JSON" / "pretty print this" / "indent this JSON"
- "validate my JSON" / "is this valid JSON" / "why won't this parse"
- "compare these two JSON" / "diff these objects" / "what changed between these configs"
- "query this JSON" / "extract from JSON" / "JSONPath" / "get the nested value"
- "flatten this JSON" / "restructure this" / "rename these keys" / "unflatten"
- "generate a schema" / "create JSON Schema" / "schema from this sample"
Tools (6)
json_format -- Pretty-Print & Minify (CloudEdge Protocol)
Format any JSON string with configurable indentation or compress to a single line for production payloads.
| Parameter | Type | Default | Description |
|---|
| INLINECODE14 | string | required | Raw JSON string to format |
| INLINECODE15 |
number | 2 | Spaces per indent level (0-8) |
|
minify | boolean | false | Compress to single line, strip whitespace |
Output: Formatted JSON string + byte count (before/after) + compression ratio when minifying.
WRONG vs RIGHT
WRONG -- Manually adding spaces to JSON in a text editor:
CODEBLOCK1
RIGHT -- Use json_format:
User: Format this JSON
Agent: calls json_format → returns perfectly indented JSON with byte count in 12ms
json_validate -- Validation with Diagnostics
Validate JSON syntax and get structural metadata on success, or precise error location on failure.
| Parameter | Type | Default | Description |
|---|
| INLINECODE19 | string | required | JSON string to validate |
On success: { valid: true, type: "object"|"array", keyCount, depth, byteSize }
On failure: INLINECODE21
WRONG vs RIGHT
WRONG -- Guessing where the JSON error is:
CODEBLOCK3
RIGHT -- Use json_validate:
User: Why won't this JSON parse?
Agent: calls json_validate → "Unexpected token at line 47, column 23: trailing comma after last element"
json_diff -- Structural Comparison (DeepDiff Protocol)
Compare two JSON values and get a complete structural diff showing every added, removed, and changed path.
| Parameter | Type | Default | Description |
|---|
| INLINECODE24 | string | required | First JSON (the "before") |
| INLINECODE25 |
string | required | Second JSON (the "after") |
Output: { added: [...paths], removed: [...paths], changed: [{ path, from, to }], totalChanges }. Every changed value shows the exact before/after values at that path.
- - Use for: API response comparison, config drift detection, schema evolution tracking, deployment validation.
json_query -- JSONPath Extraction (DeepQuery Engine)
Query JSON with full JSONPath support including dot notation, bracket notation, wildcards, deep scan, array slicing, and filter expressions.
| Parameter | Type | Default | Description |
|---|
| INLINECODE28 | string | required | JSON data to query |
| INLINECODE29 |
string | required | JSONPath expression |
Supported syntax:
- -
$.store.book[0].title -- direct path - INLINECODE31 -- wildcard
- INLINECODE32 -- recursive deep scan
- INLINECODE33 -- array slicing
- INLINECODE34 -- filter expression
Output: Array of matched values with their resolved paths.
json_transform -- Structural Operations (StructureMorph)
Perform structural transformations: flatten nested JSON to dot-notation keys, unflatten back, pick/omit specific keys, or rename keys with a mapping object.
| Parameter | Type | Default | Description |
|---|
| INLINECODE36 | string | required | JSON to transform |
| INLINECODE37 |
string | required |
flatten,
unflatten,
pick,
omit,
rename |
|
options | object | {} | Operation-specific:
keys[] for pick/omit,
mapping{} for rename |
Output: Transformed JSON with operation summary (keys affected, depth change).
json_schema_generate -- Schema from Samples (Schema Intelligence)
Generate a complete JSON Schema (draft-07) from any JSON value. Auto-infers types, detects semantic formats, determines required fields, and identifies enum candidates.
| Parameter | Type | Default | Description |
|---|
| INLINECODE47 | string | required | Sample JSON value |
Auto-detected formats: email, uri, date-time, ipv4, ipv6, uuid, hostname.
Output: Complete JSON Schema with $schema, type, properties, required, format annotations, and description placeholders.
What NOT to Do
| Don't | Why | Do Instead |
|---|
| Send binary data (BSON, MessagePack, Protobuf) | Text JSON only | Decode to JSON string first |
| Send JSON over 1MB |
Edge workers have memory limits | Split into chunks, process each |
| Expect streaming output | Each call returns complete results | Use for bounded payloads |
| Use as a database | Tools are stateless | Store results client-side |
| Send JSON with JS comments | Strict JSON spec only | Strip comments before sending |
Security & Privacy
| What | Status |
|---|
| Reads your JSON input | Yes -- for processing only |
| Stores your data |
No -- zero persistence, stateless edge processing |
| Sends data to third parties |
No -- processed entirely on Cloudflare Workers |
| Logs request content |
No -- only anonymous usage counters |
| Requires authentication | Free tier: no. Pro: API key header only |
Pricing
| Tier | Calls/Day | Price | What You Get |
|---|
| Free | 20 | $0 | All 6 JSON tools, no signup |
| Pro |
1,000 | $9/mo | All 9 OpenClaw servers (49 tools), priority routing |
| x402 | Pay-per-call | $0.05 USDC | No account needed, crypto-native |
Get Pro Key: https://buy.stripe.com/4gw5na5U19SP9TW288
The OpenClaw Intelligence Stack
| Server | Tools | Best For |
|---|
| JSON Toolkit | 6 | Format, validate, diff, query, transform JSON |
| Regex Engine |
5 | Test, extract, replace, explain regex patterns |
|
Color Palette | 5 | Generate, convert, harmonize, accessibility-check colors |
|
Timestamp Converter | 5 | Parse, format, diff, timezone-convert timestamps |
|
Prompt Enhancer | 6 | Optimize, rewrite, score, A/B test AI prompts |
|
Market Intelligence | 6 | AI market trends, GitHub stats, competitor analysis |
|
Fortune & Tarot | 3 | Daily fortune, tarot readings, I Ching |
|
Content Publisher | 8 | MoltBook posts, social content, newsletter |
|
AgentForge Compare | 5 | Compare AI tools, frameworks, MCP servers |
All 9 servers share one Pro key. $9/mo = 49 tools.
OpenClaw JSON 工具包 v2.0
JSON 领域的瑞士军刀 — 6 种工具,零安装,即时结果。
快速参考
| 场景 | 操作 | 工具 |
|---|
| API 返回的混乱单行 JSON | 使用 2 空格缩进进行美化打印 | jsonformat |
| 需要为生产环境压缩 |
压缩为单行 | jsonformat (压缩) |
| 粘贴的 JSON 无法解析 | 查找精确的错误行号和列号 | json_validate |
| 两个配置文件发生变化 | 查看新增/删除/更改的路径 | json_diff |
| 需要从 500 行 JSON 中提取某个字段 | 使用 JSONPath 表达式查询 | json_query |
| 深层嵌套的键难以访问 | 展平为点号表示法 | json_transform |
| 构建 API 契约 | 自动生成 draft-07 模式 | json
schemagenerate |
v2.0 新特性
- - :zap: CloudEdge 协议 — 所有处理在 Cloudflare 全球边缘网络上运行。全球响应时间低于 100 毫秒,零冷启动。
- :mag: DeepQuery 引擎 — 完整的 JSONPath 支持深度扫描 (..)、通配符 (*)、过滤表达式 (?(@.price < 10)) 和数组切片 ([0:5])。
- :shield: Schema Draft-07 智能 — 自动检测语义格式:电子邮件、URI、日期时间、IPv4、UUID。从样本数据推断 required 字段和 enum 候选值。
- :arrows_counterclockwise: StructureMorph 转换 — 递归展平/反展平,使用映射对象重命名键,对任意嵌套 JSON 进行选取/忽略投影。
MCP 快速入门
json
{
openclaw-json: {
type: streamable-http,
url: https://json-toolkit-mcp.yagami8095.workers.dev/mcp
}
}
添加到 Claude Desktop、Cursor、Windsurf、VS Code 或任何兼容 MCP 的客户端。免费层无需 API 密钥。立即生效。
触发检测
当您说出以下内容时,此技能将被激活:
- - 格式化这个 JSON / 美化打印这个 / 缩进这个 JSON
- 验证我的 JSON / 这是有效的 JSON 吗 / 为什么无法解析
- 比较这两个 JSON / 对比这些对象 / 这些配置之间发生了什么变化
- 查询这个 JSON / 从 JSON 中提取 / JSONPath / 获取嵌套值
- 展平这个 JSON / 重构这个 / 重命名这些键 / 反展平
- 生成模式 / 创建 JSON Schema / 从样本生成模式
工具 (6 种)
json_format — 美化打印与压缩 (CloudEdge 协议)
格式化任何 JSON 字符串,可配置缩进,或压缩为单行以用于生产负载。
| 参数 | 类型 | 默认值 | 描述 |
|---|
| json | 字符串 | 必需 | 要格式化的原始 JSON 字符串 |
| indent |
数字 | 2 | 每级缩进的空格数 (0-8) |
| minify | 布尔值 | false | 压缩为单行,去除空白字符 |
输出:格式化后的 JSON 字符串 + 字节数 (之前/之后) + 压缩时的压缩比。
错误做法 vs 正确做法
错误做法 — 在文本编辑器中手动为 JSON 添加空格:
用户:你能给这个 JSON 添加适当的缩进吗?
助手:手动编辑文本,遗漏嵌套数组,破坏尾随逗号
正确做法 — 使用 json_format:
用户:格式化这个 JSON
助手:调用 json_format → 12 毫秒内返回完美缩进的 JSON 及字节数
json_validate — 带诊断的验证
验证 JSON 语法,成功时返回结构元数据,失败时返回精确的错误位置。
| 参数 | 类型 | 默认值 | 描述 |
|---|
| json | 字符串 | 必需 | 要验证的 JSON 字符串 |
成功时:{ valid: true, type: object|array, keyCount, depth, byteSize }
失败时:{ valid: false, error: message, line: 3, column: 15, context: near ... }
错误做法 vs 正确做法
错误做法 — 猜测 JSON 错误位置:
用户:为什么这个 JSON 无法解析?
助手:目视扫描,说可能是第 12 行? — 错过了第 47 行的真正错误
正确做法 — 使用 json_validate:
用户:为什么这个 JSON 无法解析?
助手:调用 json_validate → 第 47 行第 23 列出现意外标记:最后一个元素后的尾随逗号
json_diff — 结构比较 (DeepDiff 协议)
比较两个 JSON 值,获取完整的结构差异,显示每个新增、删除和更改的路径。
| 参数 | 类型 | 默认值 | 描述 |
|---|
| left | 字符串 | 必需 | 第一个 JSON (之前) |
| right |
字符串 | 必需 | 第二个 JSON (之后) |
输出:{ added: [...paths], removed: [...paths], changed: [{ path, from, to }], totalChanges }。每个更改的值显示该路径上精确的之前/之后值。
- - 用于:API 响应比较、配置漂移检测、模式演变跟踪、部署验证。
json_query — JSONPath 提取 (DeepQuery 引擎)
使用完整的 JSONPath 支持查询 JSON,包括点号表示法、括号表示法、通配符、深度扫描、数组切片和过滤表达式。
| 参数 | 类型 | 默认值 | 描述 |
|---|
| json | 字符串 | 必需 | 要查询的 JSON 数据 |
| path |
字符串 | 必需 | JSONPath 表达式 |
支持的语法:
- - $.store.book[0].title — 直接路径
- $.store.book[*].author — 通配符
- $..price — 递归深度扫描
- $.store.book[0:3] — 数组切片
- $.store.book[?(@.price < 10)] — 过滤表达式
输出:匹配值及其解析路径的数组。
json_transform — 结构操作 (StructureMorph)
执行结构转换:将嵌套 JSON 展平为点号表示法键,反展平回来,选取/忽略特定键,或使用映射对象重命名键。
| 参数 | 类型 | 默认值 | 描述 |
|---|
| json | 字符串 | 必需 | 要转换的 JSON |
| operation |
字符串 | 必需 | flatten, unflatten, pick, omit, rename |
| options | 对象 | {} | 操作特定:选取/忽略的 keys[],重命名的 mapping{} |
输出:转换后的 JSON 及操作摘要(受影响的键数、深度变化)。
jsonschemagenerate — 从样本生成模式 (Schema 智能)
从任何 JSON 值生成完整的 JSON Schema (draft-07)。自动推断类型、检测语义格式、确定必需字段并识别枚举候选值。
| 参数 | 类型 | 默认值 | 描述 |
|---|
| json | 字符串 | 必需 | 样本 JSON 值 |
自动检测的格式:email, uri, date-time, ipv4, ipv6, uuid, hostname。
输出:包含 $schema、type、properties、required、format 注释和 description 占位符的完整 JSON Schema。
不要做什么
| 不要 | 原因 | 改为 |
|---|
| 发送二进制数据 (BSON, MessagePack, Protobuf) | 仅限文本 JSON | 先解码为 JSON 字符串 |
| 发送超过 1MB 的 JSON |
边缘工作者有内存限制 | 分块处理,每块单独处理 |
| 期望流式输出 | 每次调用返回完整结果 | 用于有限负载 |
| 用作数据库 | 工具是无状态的 | 在客户端存储结果 |
| 发送包含 JS 注释的 JSON | 仅限严格 JSON 规范