← 返回 Skills 市场
Json Format
作者
Omar Hernandez
· GitHub ↗
· v1.0.0
· MIT-0
240
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install json-format
功能描述
Format, prettify, minify, or validate JSON. Use when the user asks to format JSON, prettify JSON, beautify JSON, minify JSON, compress JSON, validate JSON, f...
使用说明 (SKILL.md)
JSON Formatter
Format and validate JSON — pretty-print with configurable indentation or minify to a single line.
Input
- A JSON string (object, array, string, number, boolean, or null)
- May be already formatted or a single minified line
- Optional action: format (default), minify, or validate-only
- Optional indent size: 2 (default) or 4 spaces
Output
- format: Pretty-printed JSON with proper indentation and line breaks
- minify: Single-line compact JSON with no whitespace
- validate: A message confirming valid or invalid JSON (with error details)
Instructions
- Receive the raw JSON string from the user.
- Determine the requested action (default: format).
- Attempt to parse the JSON:
- Call
JSON.parse(input)conceptually — parse the string strictly following JSON spec. - If parsing fails, report the error with as much detail as possible (e.g., "Unexpected token at position 42", "Missing closing bracket").
- Call
- For format action:
- Serialize the parsed value back to a string with the requested indent size (default: 2 spaces).
- Use
JSON.stringify(parsed, null, indentSize)semantics: keys are sorted by insertion order (not alphabetically), arrays and objects are expanded across multiple lines, strings are double-quoted.
- For minify action:
- Serialize with no indentation or extra whitespace:
JSON.stringify(parsed)semantics.
- Serialize with no indentation or extra whitespace:
- For validate action:
- If parsing succeeded, report "Valid JSON" along with type and top-level key count if it is an object.
- If parsing failed, report the error message.
- If sort-keys option is requested, sort all object keys alphabetically at every nesting level before serializing.
- Output the result.
Options
indent:2(default) |4— number of spaces per indent levelaction:format(default) |minify|validatesort-keys:false(default) |true— sort object keys alphabetically
Examples
Format (default, 2-space indent)
Input:
{"name":"Alice","age":30,"hobbies":["reading","coding"]}
Output:
{
"name": "Alice",
"age": 30,
"hobbies": [
"reading",
"coding"
]
}
Minify
Input:
{
"name": "Alice",
"age": 30
}
Output:
{"name":"Alice","age":30}
Validate — invalid JSON
Input:
{name: 'Alice', age: 30}
Output:
Invalid JSON: Unexpected token 'n' at position 1. Keys must be double-quoted strings and string values must use double quotes, not single quotes.
Format with 4-space indent and sort-keys
Input:
{"z":3,"a":1,"m":2}
Output:
{
"a": 1,
"m": 2,
"z": 3
}
Error Handling
- If the input is empty or whitespace-only, respond: "No input provided. Please paste a JSON string."
- If
JSON.parsefails, report the error message and the approximate position or line number if determinable. Do not attempt to silently fix the JSON — report the exact parse error. (If the user wants repair, suggest using the json-repair skill.) - If the input is valid JSON but the user asked to "format" a primitive (e.g., just
42or"hello"), format it as-is (a primitive is valid JSON). - Never truncate the output — always return the full formatted result.
安全使用建议
This skill is coherent and low-risk for its stated purpose: formatting, minifying, and validating JSON. Before using it, avoid pasting secrets or very large files (the skill promises not to truncate output, so extremely large inputs could be unwieldy). If you need automatic repair of invalid JSON, note the SKILL.md explicitly says it will not try to fix errors and suggests a separate 'json-repair' skill. Otherwise it is safe to install from a scope-of-function perspective.
功能分析
Type: OpenClaw Skill
Name: json-format
Version: 1.0.0
The skill bundle is a standard JSON formatter and validator. The instructions in SKILL.md are clearly aligned with the stated purpose of prettifying, minifying, and validating JSON strings using standard logic (JSON.parse/stringify). There are no indicators of data exfiltration, malicious execution, or prompt injection.
能力评估
Purpose & Capability
Name and description state formatting/validation of JSON and the skill requires no binaries, credentials, or install steps — exactly what you'd expect for a simple formatter.
Instruction Scope
SKILL.md only describes parsing and serializing JSON (format, minify, validate, optional key-sorting). It does not instruct the agent to read files, environment variables, system configuration, or send data to external endpoints. Error handling and options are narrowly scoped to JSON processing.
Install Mechanism
No install spec and no code files are present; this is instruction-only so nothing is written to disk and no external packages are fetched.
Credentials
The skill declares no required environment variables, credentials, or config paths. There is no disproportionate access requested for the stated functionality.
Persistence & Privilege
always is false and the skill does not request persistent or elevated privileges. Autonomous invocation is enabled (the platform default) but the skill's scope is limited and does not modify other skills or system settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install json-format - 安装完成后,直接呼叫该 Skill 的名称或使用
/json-format触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the json-format skill.
- Format, prettify, minify, or validate JSON based on user request.
- Supports optional indentation size (2 or 4 spaces), and optional alphabetical key sorting.
- Provides detailed error messages with position info on invalid JSON.
- Handles empty input with a clear message.
- Outputs primitives (numbers, strings, etc.) as valid JSON if requested.
元数据
常见问题
Json Format 是什么?
Format, prettify, minify, or validate JSON. Use when the user asks to format JSON, prettify JSON, beautify JSON, minify JSON, compress JSON, validate JSON, f... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 240 次。
如何安装 Json Format?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install json-format」即可一键安装,无需额外配置。
Json Format 是免费的吗?
是的,Json Format 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Json Format 支持哪些平台?
Json Format 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Json Format?
由 Omar Hernandez(@ohernandez-dev-blossom)开发并维护,当前版本 v1.0.0。
推荐 Skills