Any JSON object or array
Default: "Root"
Go, TS, Python, or Java
Paste JSON and click Generate to see output
Paste JSON — get Go, TypeScript, Python & Java type definitions instantly
Any JSON object or array
Default: "Root"
Go, TS, Python, or Java
Paste JSON and click Generate to see output
| JSON Type | Example | Go | TypeScript | Python | Java |
|---|---|---|---|---|---|
| string | "hello" | string | string | str | String |
| integer | 42 | int | number | int | Integer |
| float | 3.14 | float64 | number | float | Double |
| boolean | true | bool | boolean | bool | Boolean |
| null | null | interface{} | unknown | Any | Object |
| array | [1,2,3] | []T | T[] | list[T] | List<T> |
| object | {"a":1} | struct{...} | interface{...} | @dataclass class | class{...} |
API integration is the most common use case: you receive a JSON response from a REST or GraphQL API and need typed models in your language of choice. Manually writing struct definitions from a large JSON response is tedious and error-prone — a 100-line JSON object can take 30+ minutes to type out by hand, and a single mismatched field type causes runtime errors. Configuration files (package.json, terraform.tfstate, docker-compose.yml) are another frequent source: developers want type-safe access to config data. Code generation pipelines use JSON-to-type tools as a first step before generating serialization code, database schemas, or API documentation. This tool generates all 4 language outputs from a single JSON input — no signup, no API key, instant results.
Go: Field names use PascalCase with json:"field_name" struct tags. String fields use string; numbers default to float64 unless clearly integers. Nested objects become nested struct types. The struct tag preserves the original JSON key for marshaling/unmarshaling.
TypeScript: Interfaces use PascalCase (e.g., Root, Address). Optional fields (from null values) get the ? modifier. Arrays use T[] syntax. Union types are generated for arrays with mixed element types.
Python: Uses @dataclass decorator with type hints. Fields get Optional[T] for nullable values. Nested objects become nested dataclass classes. Imports from dataclasses import dataclass and from typing import List, Optional are included.
Java: Generates POJO (Plain Old Java Object) classes with private fields, public getters/setters, and proper generic collections. Uses List<T> for arrays, Integer/Double/Boolean for nullable primitive wrappers.
Paste your JSON, switch to the Go tab. The tool generates proper Go structs with json:"..." tags, nested struct types, and slice types for arrays. Fields use PascalCase with the original JSON key preserved in struct tags.
Select the TypeScript tab after pasting your JSON. Interfaces are generated with optional modifiers for nullable fields, array types using T[], and nested interfaces for nested objects.
Yes — all 4 languages are generated simultaneously. Python: @dataclass with type hints and Optional/List from typing. Java: POJO with private fields, getters/setters, and generic collections. Switch tabs to see each language.
JSON values are mapped: strings → string/str/String, integers → int/number/int/Integer, floats → float64/number/float/Double, booleans → bool/boolean/bool/Boolean, null → interface{}/unknown/Any/Object, arrays → typed collections, objects → nested types. See the type mapping table above.
Null JSON values generate optional/pointer types: *T or interface{} in Go, ? modifier in TypeScript, Optional[T] in Python, nullable wrappers in Java. Fields missing from some array elements are treated as optional across all outputs.