Skip to content

🧬 JSON → Type Definition Converter

Paste JSON and instantly generate TypeScript, PHP, Python, Go, and Rust type definitions. Handles nested objects and arrays.

✅ 100% free, no signup, runs entirely in your browser

💡 Tips

• Nested objects are automatically extracted as separate types.

• Array element types are inferred. Empty arrays become any[] / []interface{} etc.

• null is treated as optional / nullable like string | null.

• Change the root type name from the input above.

🔗 Related Tools

📖 How to Use

  1. 1
    Enter or paste JSON
    Paste JSON into the left input field. Use the Sample button to quickly load example data.
  2. 2
    Select target language
    Choose TypeScript, PHP, Python, Go, Rust, Kotlin, or Swift, and optionally change the root type name.
  3. 3
    Copy and use the type definition
    The generated type definition appears on the right. Copy it to your clipboard and paste it into your code.

❓ FAQ

How are nested objects handled?
Nested objects are automatically extracted as separate type definitions and referenced by name.
How are null fields typed?
null fields are treated as optional/nullable. Depending on the language they become Optional, ?, pointer type, etc.
Does it handle a top-level JSON array?
Yes. If the root is an array, it is automatically wrapped as { items: [...] } for type generation.