🏛️JSON to Model Class Generator

Turn JSON into TypeScript, Python or Java models

Types chosen from each JSON value

JSON valueTypeScriptPythonJava
StringstringstrString
BooleanbooleanboolBoolean
Whole numbernumberintLong
DecimalnumberfloatDouble
ObjectNested interfaceNested dataclassNested record
ArrayT[]list[T]List<T>
null or empty arrayunknownAnyObject
Field in some elements onlyname?: TOptional[T] = NoneBoxed type

The supported languages are exactly the three in the selector: TypeScript, Python and Java. Go structs are not produced here and have a tool of their own. Python output renames keys to snake_case and keeps the original key as a comment, and Java output uses records, so save the file under the same name as the top-level type.

You Might Also Need

Turning a JSON response into model classes

Pick a language, paste the JSON, and the model code comes out as TypeScript interfaces, Python dataclasses or Java records. Nested objects become types of their own, and an array of objects is inferred from every element merged together, so a field that appears in only one element is not lost.

Each language has its own trap. A Python dataclass fails to define at all when a field without a default follows one with it, so optional fields are moved to the end, and keys renamed to snake_case keep the original key in a comment. Java output uses records, and because one file may hold only one public type, only the top-level type is public. TypeScript quotes any key that is not a valid identifier. As of October 2026 the output of all three languages has been checked by compiling and running it.

Nulls, empty arrays and arrays of mixed types carry no type information, so nothing is guessed and each location is reported by path. The supported languages are only the three in the selector, and Go structs are out of scope. No deserialiser configuration or validation code is added.

Frequently Asked Questions

Why only three languages?

Because only output that was actually generated, compiled and run is offered here. A language not in the list is not produced. For Go structs there is a dedicated tool.

Why do optional fields move to the end in Python?

A dataclass raises an error at definition time when a field without a default follows one that has a default, so every Optional field is grouped at the end.

Why does Java default to boxed types?

A JSON value can be null and a primitive such as int or long cannot hold null. With boxed types off, deserialising a null fails, so boxed is the default.