DevBento logoDevBento
Tools/JSON to TypeScript & 8+ Languages Generator

JSON to TypeScript & 8+ Languages Generator

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.
Send to:
Related Conversions
Convert REST API Response to TypeScript
Generate TypeScript types from a typical REST API JSON response. Paste your API JSON output and get complete typed interfaces for your TypeScript app.
Convert JSON Config to TypeScript
Generate TypeScript types from a nested configuration object. Paste your config JSON and get complete typed interfaces ready for your TypeScript project.
Generate C# Classes from API Response
Generate C# classes with JsonPropertyName attributes from a typical REST API JSON response. Paste your API output and get production-ready C# class files.
Generate C# Classes from Config Object
Generate C# classes with JsonPropertyName attributes from a nested application configuration object. Paste your config JSON and get typed C# class files.
Generate Go Structs from API Response
Generate Go structs with JSON struct tags from a typical REST API JSON response. Paste your API JSON output and get production-ready typed Go structs.
Generate Go Structs from Config Object
Generate Go structs with JSON struct tags from a nested application configuration. Paste your config JSON and get production-ready typed Go struct code.
Generate Java Classes from API Response
Generate Java classes with Jackson annotations from a typical REST API JSON response. Paste your API JSON and get production-ready typed Java class files.
Generate Java Classes from Config Object
Generate Java classes with Jackson annotations from a nested application configuration. Paste your config JSON and get production-ready typed Java classes.
Generate Kotlin Data Classes from API Response
Generate Kotlin data classes with kotlinx.serialization annotations from a typical REST API JSON response. Paste your API output and get typed Kotlin code.
Generate Kotlin Data Classes from Config Object
Generate Kotlin data classes with kotlinx.serialization annotations from a nested application configuration object. Paste JSON, get typed Kotlin classes.
Generate Python Dataclasses from API Response
Generate Python dataclasses with type annotations from a typical REST API JSON response. Paste your JSON and get ready-to-use Python class definitions.
Generate Python Dataclasses from Config JSON
Generate Python dataclasses with type annotations from a nested configuration object. Paste your config JSON and get typed Python classes for settings modules.
Generate Rust Structs from API Response
Generate Rust structs with serde Serialize and Deserialize derives from a typical REST API JSON response. Paste your API JSON and get typed Rust structs.
Generate Rust Structs from Config Object
Generate Rust structs with serde Serialize and Deserialize derives from a nested application configuration. Paste your config JSON and get typed Rust code.
Generate JSON Schema from API Response
Generate a JSON Schema draft-07 document from a typical REST API JSON response. Paste your API JSON and get a complete validation schema for your data.
Generate JSON Schema from Config Object
Generate a JSON Schema draft-07 document from a nested application configuration. Paste your config JSON to get a complete validation schema for your data.
Generate Swift Structs from API Response
Generate Swift Codable structs from a typical REST API JSON response. Paste your API JSON output and get typed Swift Codable structs for Xcode projects.
Generate Swift Structs from Config Object
Generate Swift Codable structs from a nested application configuration. Paste your config JSON and get typed Swift structs ready for your Xcode project.
Generate Zod Schemas from API Response
Generate Zod schemas with TypeScript type inference from a typical REST API JSON response. Paste your JSON and get runtime validation schemas instantly.
Generate Zod Schema from Config JSON
Generate a Zod validation schema with TypeScript type inference from a nested configuration object. Paste config JSON and get a schema for runtime config...
Related Tools
{}JSON Formatter + Tree Viewer + Graph Visualizer
Paste JSON to pretty-print, minify, validate, or visualize as an interactive graph. Syntax highlighting, tree view, and graph view with export.
ymlJSON / YAML / TOML / CSV / XML / HTML / Markdown
Convert your data to another format first

JSON to TypeScript, Rust, C#, Swift, Kotlin, Java, Go, Python, Zod & JSON Schema Generator

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.

What is a JSON to TypeScript Generator?

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.

How to Use

  1. Paste valid JSON into the input pane on the left, or drag and drop a .json file
  2. Choose output mode: Interface (default), Type, Schema, Go, Python, Zod, Rust, C#, Swift, Kotlin, or Java
  3. Copy the generated output with the Copy button, or download as .ts, .go, .py, .json, .rs, .cs, .swift, .kt, or .java
  4. Paste the types into your project and start using them immediately

Output Modes

Interface mode (default)

Produces standard TypeScript interfaces. Best for API responses, config objects, and when you want declaration merging.

Type alias mode

Produces type declarations. Best for union types, mapped types, and when you need more flexibility in your type definitions.

Schema mode

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.

Go mode

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.

Python mode

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.

Zod mode

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.

Rust mode

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.

C# mode

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.

Swift mode

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.

Kotlin mode

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.

Java mode

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.

Type Inference Rules

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 Object Naming

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.

JSON Schema Generation

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:

Go Struct Generation

Switch 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:

Python Dataclass Generation

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:

Zod Schema Generation

Switch 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:

Rust Struct Generation

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:

C# Class Generation

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:

Swift Struct Generation

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:

Kotlin Data Class Generation

Switch 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:

Java Class Generation

Switch 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:

Common Use Cases

API Response Types

Paste a sample API response and generate types for your fetch calls. Works with REST APIs, GraphQL responses, and any JSON endpoint.

Config Object Types

Generate types for configuration files, environment variables, or settings objects. The tool handles nested configs with multiple levels of depth.

Mock Data Types

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.

© 2026 devbento.dev · built local-first