📦 JSON Schema to Code Generator
Convert JSON Schema definitions to TypeScript, Python, Go, Rust, Java, and C# code. Runs entirely in your browser.
Last updated: November 8, 2026 · By the BoltQuickTools team
Generated code will appear here...
Start your types from the schema you already have
If an API contract or config format is defined in JSON Schema, writing matching classes by hand in each service is repetitive and drifts out of date. This page drafts them in TypeScript, Python, Go, Rust, Java and C#. Treat the output as a first draft: it needs review, and some cases below produce code that will not compile.
Generating code
- Paste into JSON Schema Input (pasting generates right away) or load one of the four Samples. If you type instead, press Generate Code.
- Choose a language tab. All six are built at once, so switching is instant.
- Adjust Root type name, Export / public modifier, Include descriptions and Optional field markers. The code rebuilds on change.
- Copy Output takes the current tab. Format Schema pretty-prints your input.
One small schema, two languages
{
"title": "order",
"type": "object",
"description": "A customer order",
"required": ["id", "total"],
"properties": {
"id": { "type": "integer" },
"total": { "type": "number", "description": "Grand total" },
"placedAt": { "type": "string", "format": "date-time" },
"status": { "type": "string", "enum": ["open", "paid"] },
"notes": { "type": "array", "items": { "type": "string" } }
}
}
TypeScript output:
/** A customer order */
export interface Order {
id: number;
total: number; // Grand total
placedAt?: Date;
status?: "open" | "paid"; // values: open, paid
notes?: string[];
}
Go output:
package main
import "time"
// Order - A customer order
type Order struct {
Id int `json:"id"`
Total float64 `json:"total"` // Grand total
PlacedAt *time.Time `json:"placedAt,omitempty"`
Status *string `json:"status,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Note that the schema's title sets the root name, overriding the Root type name box, which only applies when there is no title.
Schema features it does not handle
- A root that is not an object produces empty output, along with the message "Code generated successfully for all 6 languages."
allOfand"type": ["string", "null"]both becomeanyor the language's equivalent.- Two untitled nested objects share one name. Both are typed
NestedObject, and only the first shape is generated. Give each nested object atitle. - A self-reference with
{"$ref": "#"}produces a blank type. External$reffiles give a type name with no definition.
Output to fix by hand
- Format with no description: a property with
formatand nodescriptioncomes out asemail?: string; (format: email), which is not valid code. Add a description or turn off Include descriptions. - TypeScript enum arrays:
"a" | "b"[]means something other than intended. Wrap the union in parentheses. - TypeScript dates:
date-timebecomesDate, yetJSON.parsehands you a string. - Enums elsewhere: outside TypeScript, enums become plain strings.
- Python: nested classes come after the class that uses them, so add
from __future__ import annotations.List[datetime]andList[Any]do not get their imports. - Rust:
oneOfbecomesString | i64, which does not compile. With Optional field markers off,skip_serializing_ifis still written on fields that are no longerOption. - Java: every class is in one block, each
public, so split them into files.List<Instant>lacks its import. - Go and C#: a
[]time.Timefield lacks its import, andDateTimeneedsusing System;unless implicit usings are on. - Odd property names: a key like
my-keyis not quoted in TypeScript, and reserved words liketypeare not escaped in Rust.
Questions about the output
Why does the Python or C# tab show stray text like class="syn-comment">?
That is a syntax-highlighting display bug on lines with comments. Copy Output gives the clean code, so copy rather than selecting from the screen.
Does the Export option affect every language?
No. It changes TypeScript, Rust, Java and C#. Go exports through capitalised names and Python has no such keyword. Likewise, Optional field markers has no effect on Java.
I have sample JSON and no schema. Can I use this?
Not directly. The JSON to TypeScript converter works from example data, and the JSON Schema validator checks data against a schema you already have.