quicktype

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Quicktype - 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

使用说明

  1. Parse the input to identify:
    • File path or URL
    • Target language (default: TypeScript)
    • Output file (optional)
  2. Run the quicktype script:
bash
python3 ~/.claude/skills/quicktype/scripts/quicktype.py <file> [--lang LANG] [--out FILE]
  1. Display the generated types in a fenced code block
  2. If
    --out
    specified, save to that file
  1. 解析输入以识别以下信息:
    • 文件路径或URL
    • 目标语言(默认:TypeScript)
    • 输出文件(可选)
  2. 运行quicktype脚本:
bash
python3 ~/.claude/skills/quicktype/scripts/quicktype.py <file> [--lang LANG] [--out FILE]
  1. 将生成的类型放在围栏代码块中展示
  2. 如果指定了
    --out
    参数,将类型保存到该文件

Supported Languages

支持的语言

FlagLanguage
ts
TypeScript
go
Go structs
py
Python dataclass
rs
Rust structs
swift
Swift Codable
kotlin
Kotlin data class
参数语言
ts
TypeScript
go
Go 结构体
py
Python 数据类
rs
Rust 结构体
swift
Swift Codable
kotlin
Kotlin 数据类

Examples

示例

Input:
/quicktype api/users.json
Output: TypeScript interfaces for the JSON structure
Input:
/quicktype config.json --lang go
Output: Go struct definitions
Input:
/quicktype response.json --out src/types/api.ts
Output: Types saved to specified file
输入:
/quicktype api/users.json
输出: 对应JSON结构的TypeScript接口
输入:
/quicktype config.json --lang go
输出: Go 结构体定义
输入:
/quicktype response.json --out src/types/api.ts
输出: 生成的类型保存到指定文件