quicktype
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseQuicktype - JSON to Type Generator
Quicktype - JSON转类型生成器
Generate strongly-typed interfaces from JSON files or URLs.
从JSON文件或URL生成强类型接口。
When to Use
适用场景
- User asks to generate types from JSON
- User wants TypeScript interfaces for API responses
- User needs type definitions for config files
- User mentions "quicktype" or "json to types"
- 用户要求从JSON生成类型
- 用户需要为API响应创建TypeScript接口
- 用户需要为配置文件生成类型定义
- 用户提及"quicktype"或"json转类型"
Instructions
使用说明
-
Parse the input to identify:
- File path or URL
- Target language (default: TypeScript)
- Output file (optional)
-
Run the quicktype script:
bash
python3 ~/.claude/skills/quicktype/scripts/quicktype.py <file> [--lang LANG] [--out FILE]-
Display the generated types in a fenced code block
-
Ifspecified, save to that file
--out
-
解析输入以识别以下信息:
- 文件路径或URL
- 目标语言(默认:TypeScript)
- 输出文件(可选)
-
运行quicktype脚本:
bash
python3 ~/.claude/skills/quicktype/scripts/quicktype.py <file> [--lang LANG] [--out FILE]-
将生成的类型放在围栏代码块中展示
-
如果指定了参数,将类型保存到该文件
--out
Supported Languages
支持的语言
| Flag | Language |
|---|---|
| TypeScript |
| Go structs |
| Python dataclass |
| Rust structs |
| Swift Codable |
| Kotlin data class |
| 参数 | 语言 |
|---|---|
| TypeScript |
| Go 结构体 |
| Python 数据类 |
| Rust 结构体 |
| Swift Codable |
| Kotlin 数据类 |
Examples
示例
Input:
Output: TypeScript interfaces for the JSON structure
/quicktype api/users.jsonInput:
Output: Go struct definitions
/quicktype config.json --lang goInput:
Output: Types saved to specified file
/quicktype response.json --out src/types/api.ts输入:
输出: 对应JSON结构的TypeScript接口
/quicktype api/users.json输入:
输出: Go 结构体定义
/quicktype config.json --lang go输入:
输出: 生成的类型保存到指定文件
/quicktype response.json --out src/types/api.ts