Paste an example, like an API response or a config file, and get Zod schemas with TypeScript types inferred from them. Each nested object gets its own type, and lists of records are merged, so a field that only some items have comes out optional. Other languages: Go, Rust, Python, Java, C#, Kotlin, Swift, Dart, and TypeScript.
How to use it
- Paste JSON or open a file. A list of several records gives the best types.
- The Zod code appears as you type.
- Copy it into your project or download it.
Private, local processing
This tool runs in your browser, in a background worker: nothing you paste or open is uploaded, and nothing is kept after you leave. For a list, types come from its first 1,000 items, which can be up to 5 MB of JSON. Already loaded features keep working if your connection drops. Loading another tool or jq for the first time needs a connection. When one tool isn't enough, GigaJSON opens your data with a tree, a table, JSONPath/JMESPath/jq queries, transforms, diff and history.
Questions
How are optional fields detected?
A key missing from some items gets .optional(), and a value that is sometimes null becomes a union with z.null().
Which JSON library does the code use?
Zod 3 or 4. Check data at runtime with RootSchema.parse(data); the types come from z.infer.
Can I use a large file?
Yes. The file is read in a background worker, and the types come from the first 1,000 items of a list, which is plenty to find every field. That sample can be up to 5 MB of JSON.
What generates the code?
quicktype, the open-source generator (Apache 2.0), running in your browser. Check the result before you rely on it: a value that is always 0 in your examples is typed as a whole number, even if real data can have decimals.
Is my data uploaded?
No. The code is generated in your browser, so nothing you paste or open goes to a server, and nothing is kept after you leave the page.
All tools
- JSON FormatterIndent with 2 or 4 spaces, sort keys
- JSON ValidatorLine and column of the first error
- JSON MinifierRemove whitespace, see the bytes saved
- JSON RepairFixes quotes, commas, comments, AI output
- JSON Schema GeneratorA JSON Schema from examples
- JSON Schema ValidatorCheck JSON against a schema
- JSON Token CounterCount tokens, select data, compare JSON and TOON
- JSON EditorTree and code editing, undo and history
- Large JSON ViewerTree, table and search for huge files
- JSON Lines ViewerJSONL and NDJSON logs as a table
- JSON VisualizerThe data as a graph, PNG and SVG export
- JSON DiffChanges between two documents
- JSON Path FinderClick a value, copy its path
- JSONPath TesterJSONPath, JMESPath and jq, live
- JMESPath PlaygroundJMESPath, for AWS CLI queries too
- jq PlaygroundReal jq in your browser
- JSON to CSVNested objects become dotted columns
- JSON to ExcelAn .xlsx sheet, numbers kept as numbers
- CSV to JSONDelimiters detected, 007 stays 007
- JSON to XML@keys become attributes
- XML to JSONRSS feeds, sitemaps, SOAP responses
- JSON to YAMLReadable YAML, ambiguous strings quoted
- YAML to JSONAnchors and multiple documents
- JSON Lines to JSONNDJSON or JSONL into one array
- JSON to JSON LinesA JSON array as one record per line
- JSON to TOONConvert JSON to TOON, with token counts
- JSON to TypeScriptInterfaces inferred from your data
- JSON to GoGo structs with json tags
- JSON to RustRust structs that derive serde's Serialize and Deserialize
- JSON to PythonPython dataclasses with type hints
- JSON to JavaJava classes with getters and setters
- JSON to C#C# classes with System.Text.Json attributes
- JSON to KotlinKotlin data classes
- JSON to SwiftSwift structs that conform to Codable, with CodingKeys
- JSON to DartDart classes with fromJson and toJson
- JSON to ZodZod schemas with TypeScript types inferred from them
- JWT DecoderHeader, payload and expiry, locally
- JSON EscapeText to a JSON string and back
- Sample JSON FilesDownload test JSON, 100 KB to 1 GB
- Sample JSON Lines FilesDownload test NDJSON, one record per line
- Sample CSV FilesDownload test CSV, 100 KB to 1 GB
- Sample XML FilesDownload test XML, 100 KB to 1 GB
- Large JSON File GeneratorTest data from 100 KB to 1 GB