0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Configuration
Convert a JSON object to models or classes in multiple languages: TypeScript, JavaScript, C#, Java, Python, Go, PHP, Kotlin, C++, and Rust. You can paste the JSON manually or upload a .json.
JSON input

How it works

This tool reads a sample JSON and infers its structure to generate the equivalent classes or types in the language you choose: C#, C++, Go, Java, JavaScript, Kotlin, PHP, Python, Rust, or TypeScript.

From the keys and the types of the JSON's values, it deduces the property names and their types (text, number, boolean, lists). Nested objects become their own classes or types.

It is a quick way to create the data models to consume an API without writing them by hand. You can paste the JSON or load a file; everything is processed in your browser.

Examples

{ "id": 1, "name": "Ada" }interface RootObject { id: number; name: string; }Output in TypeScript: each property receives the type inferred from the value.
{ "user": { "id": 1 } }A separate class or type is generated for the nested "user" object.Objects inside objects produce their own models, linked by a property.

Use cases

  • Create the classes of a client that consumes an API from a sample JSON response.
  • Convert a configuration or webhook JSON into strong types for your language.
  • Save the repetitive work of typing out models with many properties by hand.

Frequently asked questions

How does it decide the type of each property?

From the example's value: "text" is a string, 36 is a number, true/false is a boolean, and [ ] is a list of its elements' type. That is why it is best to use a JSON with representative values.

What happens with a null value?

A null carries no type information, so it cannot be inferred with certainty. If a property can be null, include an example with a real value and adjust the nullability in the generated code.

Does it generate models from an array at the root?

Yes. It takes the first element of the array as the object template and generates the model for that element, which represents the whole list.

Do the generated names respect the language's convention?

They are derived from the JSON's keys, adapting them to the chosen language. Always review the result, especially if the keys have special characters or reserved names.