JSON to code generator

Paste a JSON sample and get ready to use model types for TypeScript, C#, Python, Go, Java or Kotlin. Fields that are missing in some items become optional, null values become nullable and nested objects get their own named types.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Paste a JSON samplePaste an API response or open a .json file. More items in an array give better results.
  2. Pick a languageChoose TypeScript, C#, Python, Go, Java or Kotlin and the style you use, such as records or dataclasses.
  3. Copy the codeCheck the generated types, then copy them or download them as a file.

Types inferred from real data

Writing model classes for a large API response by hand is slow and easy to get wrong. This tool reads your JSON sample and works out the type of every field. When a list contains several objects, all of them are compared: a field that some objects do not have becomes optional, and a field that is null in some objects becomes nullable.

Numbers are split into whole numbers and decimals, and whole numbers beyond the 32 bit range become long or int64. Strings that look like ISO dates, such as 2026-10-27 or 2026-10-27T09:30:00Z, can become date types in C#, Python, Go and Java. Nested objects get their own type named after their key, and objects with the same shape share one type.

Names that follow each language

Keys like user_name, First Name or createdAt are turned into the naming style of the language: PascalCase properties in C#, snake_case in Python, camelCase in Java and Kotlin, exported names in Go. When the new name differs from the JSON key, the original key is kept in an attribute or tag, so serialization still matches the data. Reserved words and keys that start with a digit are renamed safely.

The result is a starting point. Check field types that could not be decided from your sample, for example a field that is always null or always an empty list.

Frequently asked questions

Is my JSON uploaded anywhere?

No. The types are generated in your browser. API responses with customer data or keys never leave your device.

How are optional fields detected?

If the JSON contains a list of objects, every object is compared. A field that is missing from at least one object is marked optional. With a single object, every field is treated as required.

What happens with fields that are always null?

The type cannot be known from the sample, so the field gets a general type such as unknown, object, Any or JsonElement. Add a sample where the field has a value to get a precise type.

Why is my 1.0 typed as a decimal number?

The tool looks at how the number is written. 1.0 or 2.5 become double or float, 1 becomes an integer. If a field is whole in some items and decimal in others, the decimal type is used.

Can I use the result in production code?

Yes, the code compiles as it is in the usual setups. Review names and types before you commit it, because a sample can never show every possible value.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.