JSON to Type Generator

Paste a sample JSON to automatically generate a TypeScript interface, Go struct, or Python dataclass type definition.

Runs 100% in your browser — your data is never sent to a server.
The result will appear here

Try This Next

Finished here? These might be your next step.

Frequently Asked Questions

The type of every value in your sample JSON (string/number/boolean/object/array) is inspected; nested objects get their own named types. Arrays infer their type only from the first element.

Since the real type can't be determined from a null sample, it's generated as optional any in TypeScript, interface{} in Go, and Optional[Any] in Python.

In TypeScript the key is kept quoted ("weird-key": number), in Go the field name is converted to PascalCase while the original key is preserved in the json tag, and in Python it's converted to underscores with a comment noting the original key.

Last updated: