← 返回 Skills 市场
ivangdavila

JSON

作者 Iván · GitHub ↗ · v1.0.0
linuxdarwinwin32 ✓ 安全检测通过
2102
总下载
3
收藏
16
当前安装
1
版本数
在 OpenClaw 中安装
/install json
功能描述
Work with JSON data structures, APIs, and serialization effectively.
使用说明 (SKILL.md)

Schema & Validation

  • Always validate against JSON Schema before processing untrusted input—don't assume structure
  • Define schemas for API responses—catches contract violations early
  • Use additionalProperties: false to reject unknown fields in strict contexts

Naming & Consistency

  • Pick one convention and stick to it—camelCase for JS ecosystems, snake_case for Python/Ruby
  • Avoid mixed conventions in same payload—userId alongside user_name confuses consumers
  • Use plural for collections: "users": [] not "user": []

Null Handling

  • Distinguish "field is null" from "field is absent"—they mean different things
  • Omit optional fields entirely rather than sending null—reduces payload, clearer intent
  • Document which fields are nullable in schema—don't surprise consumers

Dates & Times

  • Always use ISO 8601: "2024-01-15T14:30:00Z"—no ambiguous formats like "01/15/24"
  • Include timezone or use UTC with Z suffix—local times without zone are useless
  • Timestamps as strings, not epoch integers—human-readable, no precision loss

Numbers & IDs

  • Large IDs as strings: "id": "9007199254740993"—JavaScript loses precision above 2^53
  • Money as string or integer cents—never float: "price": "19.99" or "price_cents": 1999
  • Avoid floats for anything requiring exactness—currency, coordinates with precision

Structure Best Practices

  • Keep nesting shallow—3 levels max; flatten or split into related endpoints
  • Consistent envelope for APIs: {"data": ..., "meta": ..., "errors": ...}
  • Paginate large arrays—never return unbounded lists; include next/prev links or cursor

API Response Patterns

  • Errors as structured objects: {"code": "INVALID_EMAIL", "message": "...", "field": "email"}
  • Include request ID in responses for debugging: "request_id": "abc-123"
  • Return created/updated resource in response—saves client a follow-up GET

Serialization

  • toJSON() method silently overrides output—Date becomes string, custom classes may surprise
  • Map, Set, BigInt don't serialize—need custom replacer function
  • Circular references throw—detect cycles before stringify or use libraries like flatted
  • Strip sensitive data before serializing—don't rely on client to ignore extra fields

Parsing Safety

  • __proto__ key can pollute prototypes—sanitize input or use Object.create(null)
  • Parse in try/catch—malformed JSON from external sources is common
  • Reviver function for type reconstruction: dates, BigInt, custom types

Unicode

  • Emoji need surrogate pairs in escapes: 😀 = \uD83D\uDE00—single \u1F600 invalid
  • Control chars U+0000–U+001F must be escaped—pasted text may contain invisible ones
  • BOM at file start breaks parsing—strip \uFEFF from file input
功能分析
Type: OpenClaw Skill Name: json Version: 1.0.0 The skill bundle contains only metadata and a markdown file (`SKILL.md`) detailing best practices for working with JSON data. There is no executable code, no instructions for the agent to perform any actions beyond providing information, and no evidence of prompt injection, data exfiltration, malicious execution, or any other high-risk behaviors. The content is purely informational and aligns with its stated purpose.
能力评估
Purpose & Capability
The name/description (
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install json
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /json 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
Slug json
版本 1.0.0
许可证
累计安装 16
当前安装数 16
历史版本数 1
常见问题

JSON 是什么?

Work with JSON data structures, APIs, and serialization effectively. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2102 次。

如何安装 JSON?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install json」即可一键安装,无需额外配置。

JSON 是免费的吗?

是的,JSON 完全免费(开源免费),可自由下载、安装和使用。

JSON 支持哪些平台?

JSON 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。

谁开发了 JSON?

由 Iván(@ivangdavila)开发并维护,当前版本 v1.0.0。

💬 留言讨论