How to use
- sample.jsonopenapi.yaml
Add sample data or a schema
- TypeScript, Zod and more
Generate types and schemas
Paste sample JSON, a JSON Schema or an OpenAPI document (JSON / YAML) into the input pane, or click “Open file”. The sample buttons let you try it.
Choose the output: TypeScript, Zod, JSON Schema, Go, Python, Kotlin, Swift, C#, Rust or Java. The result updates as you type.
Adjust the root type name, how nested types are named, whether date-like strings become date types and whether integers are told from decimals. TypeScript and Python also have style options (interface / type, dataclass / Pydantic / TypedDict).
To merge samples whose keys or types differ, paste several JSON documents one after another (JSON Lines works too). Keys missing from any sample become optional.
Copy the result or download it as a file.
What it does
10 output formats
TypeScript (interface / type, readonly), Zod, JSON Schema (draft 2020-12), Go struct, Python (dataclass / Pydantic v2 / TypedDict), Kotlin data class, Swift Codable, C# record, Rust serde and Java record.
Merging several samples
With several JSON documents, keys present in only some become optional, a mix of integers and decimals becomes a decimal, values containing null become nullable and differing types become a union. An empty array never erases the element type seen in other samples.
Keys become valid identifiers
Reserved words (class, type…), symbols, spaces, leading digits, empty keys and non-ASCII keys are turned into identifiers valid in each language, and the original key is kept in a json tag, @SerialName and similar. Duplicate names get a number.
Schemas and OpenAPI as input
Reads JSON Schema and OpenAPI (2.0 / 3.x) components.schemas, with $ref, enum, nullable, allOf and oneOf / anyOf. YAML works too. $ref pointing to other files is not followed.
Date and number detection
Detects ISO 8601 date and date-time strings and lets you choose between date types and plain strings. Integers, decimals and 64-bit integers are told apart.
Processed on your device
Inference and generation run in a Web Worker in your browser and nothing is uploaded. Large input rarely freezes the page and is stopped after 30 seconds.
Use cases
- Make TypeScript types or a Zod schema from an API response example
- Make Go structs (with json tags) or Python dataclasses / Pydantic models from JSON
- Make Kotlin, Swift, C#, Rust or Java models from OpenAPI components.schemas
- Create a JSON Schema (draft 2020-12) from sample JSON for validation
- Write down the shape of a config or stored data as types
Supported formats
Input
Output
Capability matrix
| Feature | Support | Notes |
|---|---|---|
| Infer types from sample JSON | Supported | Merges several samples |
| Generate from JSON Schema / OpenAPI components.schemas | Supported | $ref, enum, allOf and more |
| Detect date-like strings and switch to date types | Supported | — |
| Turn keys into identifiers (reserved words, symbols, leading digits, empty) | Supported | The original key is kept in an attribute / tag |
| Mixed types (unions) | Partial | TypeScript, Zod, Python and JSON Schema use unions; other languages use an any-JSON-value type |
| Keys a Go json tag cannot hold (empty, quotes, commas…) | Partial | Those fields use json:"-" and a warning is shown |
| Fetching data from a real API | Not supported | No network access; paste the response instead |
| A guarantee that the types are complete | Not supported | It is an inference from samples; values or types that never appear are not reflected |
| External-file $ref, types from OpenAPI paths | Not supported | Only components.schemas / $defs are read |
| Offline use | Supported | Works without a connection once loaded |
Limits & notes
- Input is limited to 5,000,000 characters.
- Nesting is limited to 100 levels, and 500 documents when several are listed.
- Up to 3,000 types and 500,000 values are analyzed. Beyond that an error is shown.
- Processing is stopped after 30 seconds.
- Integers with 19 or more digits are treated as decimals (floating point).
- Non-string enums use only the value type, and description text is not included in the output.
- Works on a phone, but PC is recommended for pasting long JSON.
Privacy & safety
Your JSON, schemas and files are processed only inside your browser. Nothing is sent to or stored on any server, so you can safely use responses from internal APIs. Closing the page clears the content.
FAQ
How do I generate TypeScript types from JSON?
Can I generate a Zod schema from JSON?
Is the type correct with only one sample?
Can I generate types from OpenAPI?
What happens to keys like class or type, or keys with symbols?
Is my data sent to a server?
Related tools
JSON Studio — Formatter & Validator
Paste JSON to format, minify or validate it instantly. Errors are shown with the exact line, column and cause, and comments or trailing commas can be auto-repaired. Your data never leaves your device.
OpenAPI Studio — Viewer & Validator
Paste an OpenAPI 3.0 / 3.1 or Swagger 2.0 definition to browse endpoints by tag and schemas as trees, and to check it against the official schemas with line and column. It never calls the API or fetches external files, and nothing leaves your device.
YAML / TOML Studio — Validate, Format & Convert
Paste YAML, TOML or JSON to validate, format or convert it. Errors show the exact line and column, and type traps such as “no becomes false” and anything lost in conversion are flagged up front. Your data never leaves your device.
CSV, JSON, XML & Excel Converter
Convert between CSV, TSV, JSON, JSON Lines, XML and Excel (.xlsx) by pasting or opening a file. Values stay as text by default, so zero-padded postal codes, phone numbers and long IDs are never changed. Everything runs in your browser; your data is not uploaded.
curl Converter
Paste “Copy as cURL” from Chrome or Firefox to see the method, URL, headers, cookies and body in tables, then convert to 12 kinds of code. The request is never sent and everything runs in your browser. Authorization and cookies can be hidden before you share.
Diff Tool — Text & Code Compare
Paste or drop two versions and see added and removed lines, plus the exact words that changed inside each line. Copy or save the result as a unified patch. Nothing leaves your browser.
Last updated: