Convert JSON to TypeScript, Go, Rust, Python, Zod, or JSON Schema instantly. Paste JSON, get typed interfaces, structs, or schemas with nested support.
Paste JSON on the left to generate TypeScript types.
Paste JSON and get TypeScript interfaces, Go structs, Python dataclasses, Zod schemas, Rust structs, C# classes, Swift structs, Kotlin data classes, Java classes, or a JSON Schema in seconds. The tool parses your data, infers types for every field, and generates named types for nested objects. No signup, no server calls, no dependencies.
A JSON to TypeScript generator takes a sample JSON object and produces corresponding TypeScript type definitions (interfaces, type aliases, or Zod schemas) by inferring the type of each field. Instead of manually writing types that mirror your API responses or config objects, you paste a representative JSON sample and the tool generates the types automatically. This saves time, reduces errors from manual type definitions going out of sync with actual data, and handles edge cases like nested objects, arrays of mixed types, and nullable fields. The same approach works for Go structs, Python dataclasses, Rust structs, C# classes, Swift structs, Kotlin data classes, Java classes, and JSON Schema.
.json file.ts, .go, .py, .json, .rs, .cs, .swift, .kt, or .javaProduces standard TypeScript interfaces. Best for API responses, config objects, and when you want declaration merging.
Produces type declarations. Best for union types, mapped types, and when you need more flexibility in your type definitions.
Produces a JSON Schema (draft-07) from your data. The schema includes typed properties, required field lists, integer vs float detection, and recursive nested object schemas. Download as schema.json for use with validation libraries like Ajv.
Produces Go structs with JSON struct tags. Each field gets a PascalCase exported name and a json:"..." tag matching the original key. Optional fields (missing from some array items) include omitempty. Download as generated.go for direct use in your Go project.
Produces Python dataclasses with type annotations. Fields use snake_case names, missing fields from array items are typed as Optional[T] = None, and common types are imported from typing. Download as models.py for use in your Python project.
Produces Zod schemas with type inference. Each object becomes a z.object() with typed fields, missing fields use z.optional(), and an inferred TypeScript type is exported. Download as schema.ts for use with Zod validation.
Produces Rust structs with serde derives. Each struct gets #[derive(Serialize, Deserialize)], fields use snake_case names, and #[serde(rename)] is added when the JSON key differs from the field name. Optional fields are wrapped in Option<T>. Download as models.rs for use with serde.
Produces C# classes with System.Text.Json attributes. Each property gets [JsonPropertyName("...")], properties use PascalCase names, and optional fields are nullable (T?). Download as Models.cs for use in .NET projects.
Produces Swift Codable structs. Each struct conforms to Codable, properties use camelCase names, and CodingKeys enums are generated when property names differ from JSON keys. Optional fields use T?. Download as Models.swift for use in iOS/macOS projects.
Produces Kotlin data classes with kotlinx.serialization annotations. Each class gets @Serializable, properties use camelCase names, and @SerialName("...") preserves original JSON keys. Optional fields are nullable with null defaults. Download as Models.kt for use in Android/Kotlin Multiplatform projects.
Produces Java classes with Jackson annotations. Each field gets @JsonProperty("..."), fields use camelCase names, and optional fields are marked @Nullable. Download as Models.java for use in Spring Boot and other Java projects.
The tool maps JSON values to types across all supported languages:
| JSON Value | TypeScript | Go | Python | Rust | C# | Swift | Kotlin | Java | JSON Schema |
|---|---|---|---|---|---|---|---|---|---|
"hello" |
string |
string |
str |
String |
string |
String |
String |
String |
"string" |
42 |
number |
int |
int |
i64 |
long |
Int |
Long |
long |
"integer" |
3.14 |
number |
float64 |
float |
f64 |
double |
Double |
Double |
double |
"number" |
true |
boolean |
bool |
bool |
bool |
bool |
Bool |
Boolean |
boolean |
"boolean" |
null |
null |
interface{} |
Any |
serde_json::Value |
object |
Any? |
Any? |
Object |
"null" |
{} |
Record<string, unknown> |
map[string]interface{} |
dict[str, Any] |
HashMap<String, serde_json::Value> |
Dictionary<string, object> |
[String: Any] |
Map<String, Any?> |
Map<String, Object> |
{} |
[] |
unknown[] |
[]interface{} |
list[Any] |
Vec<serde_json::Value> |
List<object> |
[Any] |
List<Any?> |
List<Object> |
{} |
[{ ... }] |
TypeName[] |
[]StructName |
list[TypeName] |
Vec<StructName> |
List<ClassName> |
[StructName] |
List<DataClass> |
List<ClassName> |
{ "items": { ... } } |
Nested objects get path-based names to avoid collisions. Given this JSON:
{
"user": {
"name": "Alice",
"address": { "city": "NYC" }
}
}
The tool generates:
interface RootUserAddress {
city: string;
}
interface RootUser {
name: string;
address: RootUserAddress;
}
interface Root {
user: RootUser;
}
The naming convention uses the key path in PascalCase: user.address becomes RootUserAddress.
Switch to Schema mode to generate a JSON Schema (draft-07) from your data:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" },
"address": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
},
"required": ["name", "age", "address"]
}
Key features of Schema mode:
42 → "integer", 3.14 → "number")oneOf for mixed-type arrays{} (any items), empty objects include additionalProperties: trueSwitch to Go mode to generate Go structs with JSON struct tags:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
package generated
type RootAddress struct {
City string `json:"city"`
}
type Root struct {
Name string `json:"name"`
Age int `json:"age"`
Address RootAddress `json:"address"`
}
Key features of Go mode:
omitempty added for optional fields (detected from array item variations)map[string]interface{}Switch to Python mode to generate Python dataclasses with type annotations:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
from dataclasses import dataclass, field
from typing import Optional, Any, Dict
@dataclass
class RootAddress:
city: str = ""
@dataclass
class Root:
name: str = ""
age: int = 0
address: RootAddress = field(default_factory=RootAddress)
Key features of Python mode:
Optional[T] = None for fields missing from some array itemsDict[str, Any]typing moduleSwitch to Zod mode to generate Zod schemas with TypeScript type inference:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
import { z } from "zod";
export const RootAddressSchema = z.object({
city: z.string(),
});
export type RootAddress = z.infer<typeof RootAddressSchema>;
export const RootSchema = z.object({
name: z.string(),
age: z.number(),
address: RootAddressSchema,
});
export type Root = z.infer<typeof RootSchema>;
Key features of Zod mode:
z.object() schemaz.optional(T)z.inferz.union([...])Switch to Rust mode to generate structs with serde derives:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct RootAddress {
pub city: String,
}
#[derive(Serialize, Deserialize)]
pub struct Root {
pub name: String,
pub age: i64,
pub address: RootAddress,
}
Key features of Rust mode:
#[derive(Serialize, Deserialize)] on every struct#[serde(rename)] when JSON key differs from field nameOption<T> for fields missing from some array itemsHashMap<String, serde_json::Value>Switch to C# mode to generate classes with System.Text.Json attributes:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
public class RootAddress
{
[JsonPropertyName("city")]
public string City { get; set; }
}
public class Root
{
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("age")]
public long Age { get; set; }
[JsonPropertyName("address")]
public RootAddress Address { get; set; }
}
Key features of C# mode:
[JsonPropertyName("key")] on every propertyT?) for optional fieldsDictionary<string, object>Switch to Swift mode to generate Codable structs:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
struct RootAddress: Codable {
var city: String
}
struct Root: Codable {
var name: String
var age: Int
var address: RootAddress
}
Key features of Swift mode:
CodableCodingKeys enum generated when property names differ from JSON keysT?) for optional fieldsSwitch to Kotlin mode to generate @Serializable data classes:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
@Serializable
data class RootAddress(
@SerialName("city")
val city: String
)
@Serializable
data class Root(
@SerialName("name")
val name: String,
@SerialName("age")
val age: Long,
@SerialName("address")
val address: RootAddress
)
Key features of Kotlin mode:
@Serializable on every data class@SerialName("key") preserves original JSON key namesT? = null) for optional fieldsSwitch to Java mode to generate classes with Jackson annotations:
{
"name": "Alice",
"age": 30,
"address": { "city": "NYC" }
}
Produces:
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;
public class RootAddress
{
@JsonProperty("city")
private String city;
}
public class Root
{
@JsonProperty("name")
private String name;
@JsonProperty("age")
private long age;
@JsonProperty("address")
private RootAddress address;
}
Key features of Java mode:
@JsonProperty("key") on every field@Nullable annotation for optional fieldsMap<String, Object>Paste a sample API response and generate types for your fetch calls. Works with REST APIs, GraphQL responses, and any JSON endpoint.
Generate types for configuration files, environment variables, or settings objects. The tool handles nested configs with multiple levels of depth.
Use sample mock data to generate types for your test fixtures. Ensures your mocks match the actual data shape.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.