Code Generators
25 free tools · 100% client-side
Generate type-safe classes and models from JSON or XML for Java, Python, TypeScript, C#, Go, Rust, Kotlin, Swift, Dart, and Ruby.
Start here
Most-used Code Generators
JSON to TypeScript
Paste a JSON or XML sample — the format is auto-detected — and get typed TypeScript models with names, nesting and nullability inferred for you.
JSON to Java
Paste a JSON or XML sample — the format is auto-detected — and get typed Java models with names, nesting and nullability inferred for you.
JSON to Python
Paste a JSON or XML sample — the format is auto-detected — and get typed Python models with names, nesting and nullability inferred for you.
All 25 Code Generators
JSON to Java
Paste a JSON or XML sample — the format is auto-detected — and get typed Java models with names, nesting and nullability inferred for you.
JSON to Python
Paste a JSON or XML sample — the format is auto-detected — and get typed Python models with names, nesting and nullability inferred for you.
JSON to Objective-C
Paste a JSON or XML sample — the format is auto-detected — and get typed Objective-C models with names, nesting and nullability inferred for you.
JSON to JSON Schema
Paste a JSON or XML sample — the format is auto-detected — and get typed JSON Schema models with names, nesting and nullability inferred for you.
JSON to Swift
Paste a JSON or XML sample — the format is auto-detected — and get typed Swift models with names, nesting and nullability inferred for you.
JSON to C#
Paste a JSON or XML sample — the format is auto-detected — and get typed C# models with names, nesting and nullability inferred for you.
JSON to Go
Paste a JSON or XML sample — the format is auto-detected — and get typed Go models with names, nesting and nullability inferred for you.
JSON to Rust
Paste a JSON or XML sample — the format is auto-detected — and get typed Rust models with names, nesting and nullability inferred for you.
JSON to Crystal
Paste a JSON or XML sample — the format is auto-detected — and get typed Crystal models with names, nesting and nullability inferred for you.
JSON to C++
Paste a JSON or XML sample — the format is auto-detected — and get typed C++ models with names, nesting and nullability inferred for you.
JSON to TypeScript
Paste a JSON or XML sample — the format is auto-detected — and get typed TypeScript models with names, nesting and nullability inferred for you.
JSON to JavaScript PropTypes
Paste a JSON or XML sample — the format is auto-detected — and get typed JavaScript PropTypes models with names, nesting and nullability inferred for you.
JSON to Kotlin
Paste a JSON or XML sample — the format is auto-detected — and get typed Kotlin models with names, nesting and nullability inferred for you.
JSON to Elm
Paste a JSON or XML sample — the format is auto-detected — and get typed Elm models with names, nesting and nullability inferred for you.
JSON to Ruby
Paste a JSON or XML sample — the format is auto-detected — and get typed Ruby models with names, nesting and nullability inferred for you.
JSON to Dart
Paste a JSON or XML sample — the format is auto-detected — and get typed Dart models with names, nesting and nullability inferred for you.
JSON to Pike
Paste a JSON or XML sample — the format is auto-detected — and get typed Pike models with names, nesting and nullability inferred for you.
JSON to Haskell
Paste a JSON or XML sample — the format is auto-detected — and get typed Haskell models with names, nesting and nullability inferred for you.
XML to Java
Paste an XML sample, get typed Java models — names, nesting and nullability inferred for you.
XML to Python
Paste an XML sample, get typed Python models — names, nesting and nullability inferred for you.
XML to C#
Paste an XML sample, get typed C# models — names, nesting and nullability inferred for you.
XML to Go
Paste an XML sample, get typed Go models — names, nesting and nullability inferred for you.
XML to TypeScript
Paste an XML sample, get typed TypeScript models — names, nesting and nullability inferred for you.
JSON to Zod
Paste a JSON sample, get a runtime-validating Zod schema plus its inferred TypeScript type — z.object, z.array and nested schemas built for you.
JSON to Pydantic
Paste a JSON sample, get clean Pydantic BaseModel classes — nested models named from your keys, Optional[...] where the sample had null, no positional-argument helper code to fight.
Learn more
From sample payload to typed models in seconds
Hand-writing model classes for an API response is the most mechanical work in programming: read a field, declare a property, guess the type, repeat for forty fields across six nested objects. These generators do it from a single pasted sample — names, nesting, arrays, optionality and types inferred — for nineteen target languages including Java, Python, TypeScript, C#, Go, Rust, Kotlin, Swift, and Dart, powered by quicktype, the same engine behind the most popular IDE plugins.
Both JSON and XML samples work as input (XML is parsed to a data model first, attributes included), and the output follows each language's idioms: data classes in Kotlin, structs with serde derives in Rust, dataclasses in Python, interfaces plus runtime converters in TypeScript. Generated code includes the serialization helpers, so the round trip from wire format to typed object ships with the models.
Getting the best output from one sample
Generation quality follows sample quality. Use a response where optional fields are present at least once, arrays contain at least one element, and numeric fields show their real range (a 1 could be an int; 1.5 settles it). If a field can be null, include a null occurrence so the generator marks it optional. Thirty seconds spent enriching the sample saves the manual type-fixing that generators are supposed to eliminate.
Which language family should I use?
The generator hub covers nineteen output languages, but they cluster into a handful of practical families. JVM shops reach for Java or Kotlin; .NET and Unity teams want C#; frontend engineers pull TypeScript interfaces, JavaScript PropTypes, or Flow types straight from an API response; Python and Ruby cover scripts, data pipelines, and Rails models; Go and Rust generate structs for high-performance services and CLIs; Swift, Objective-C, and C++ target native iOS, macOS, and embedded code; Dart feeds Flutter apps; and Elm, Crystal, Pike, and Haskell serve smaller, more particular ecosystems. A nineteenth option, JSON Schema, is not a programming language at all — it is a contract other tools validate against, and two more targets generate runtime VALIDATORS rather than plain types: JSON to Zod for TypeScript projects that want a schema and a type from one artifact, and JSON to Pydantic for Python projects (FastAPI especially) that want validation on construction rather than a plain class. Each family shares the same input step (paste a JSON or XML sample) and the same quicktype engine underneath, so switching target languages mid-project costs nothing but a dropdown click.
| Tool | Input | Output | Best for |
|---|---|---|---|
| Java & Kotlin generators | JSON or XML sample | Java classes / Kotlin data classes | Backend services on the JVM |
| C# generator | JSON or XML sample | C# classes, System.Text.Json-ready | .NET backends and Unity projects |
| TypeScript, JavaScript & Flow generators | JSON or XML sample | TS interfaces, JS PropTypes, or Flow types | Frontend apps consuming an API |
| Python & Ruby generators | JSON or XML sample | Python dataclasses / Ruby classes | Scripts, data pipelines, Rails backends |
| Go & Rust generators | JSON or XML sample | Go structs / Rust structs with serde derives | High-performance services and CLIs |
| Swift, Objective-C & C++ generators | JSON or XML sample | Swift Codable structs, Obj-C classes, or C++ structs | iOS/macOS apps and native code |
| Dart generator | JSON or XML sample | Dart classes with JSON serialization | Flutter apps |
| Elm, Crystal, Pike & Haskell generators | JSON or XML sample | Idiomatic types for each language | Niche or functional-language projects |
| JSON Schema generator | JSON or XML sample | A JSON Schema document | API contracts and payload validation |
| Zod & Pydantic generators | JSON sample | Zod schema + z.infer type / Pydantic BaseModel classes | Runtime validation at the API boundary |
Help
Frequently asked questions
Everything you need to know about the Code Generators.
01How accurate are the inferred types?
As accurate as the sample allows: types are inferred from the values present, unions from conflicting occurrences, and optionality from fields that appear in some objects but not others. The generator can't see fields your sample omits — feed it a representative payload and the output is production-ready scaffolding.
02Which languages are supported?
Nineteen targets: Java, Python, TypeScript, JavaScript (PropTypes), Flow, C#, Go, Rust, Kotlin, Swift, Objective-C, C++, Dart, Ruby, Elm, Crystal, Pike, Haskell, and JSON Schema — each with a dedicated page for JSON input and another for XML input — plus two runtime-validation targets, Zod and Pydantic, generated from a JSON sample.
03Is my API response uploaded to generate the code?
No — quicktype runs compiled to WebAssembly/JavaScript inside your browser. The sample, which often contains real customer data, never leaves your machine; generation works offline once the page has loaded.
Learn the format
Guides for code generators
How to Validate JSON Against a Schema in Python and JavaScript
Validate JSON against a schema with Ajv in Node and jsonschema in Python: install, compile, read the error objects, and wire validation into CI.
9 min readReference · JSONJSON Examples: From Hello World to Real API Payloads
Copy-ready JSON examples: basic objects, arrays, nested structures, API responses, configuration files — each explained line by line.
2 min readGuide · JSONPretty Print JSON in Python: Every Method That Matters
All the ways to pretty print JSON in Python: json.dumps with indent, sort_keys, the python -m json.tool one-liner, files, and Unicode gotchas.
2 min readTutorial · JSONJSON Schema Tutorial: Contracts for Your JSON
Learn JSON Schema from zero: types, required properties, nested objects, arrays, formats — with a complete example and how to generate schemas from samples.
2 min readTutorial · Data FormatsXML Tutorial: Structure, Syntax & Survival Skills
A working developer's XML tutorial: elements, attributes, namespaces, escaping, and well-formedness rules — with the errors that actually break parsers.
2 min read