Back
JSON to TypeScript, Go, Python & Rust
Formatters
Loading
Loading tool
Preparing the tool. The remaining time is not yet known.
All processing for this tool happens in your browser. Your input is not sent to a server.
About this tool
Infer TypeScript, Go, Python and Rust types from JSON, with optional fields, null handling and number precision checks.
Common uses
- Turn API response samples into client or server type definitions.
- Infer shared fields, optional fields and nested structures from object arrays.
- Check integer and decimal precision risks before generating target types.
How to use it
- 1.Paste JSON, name the root type and choose TypeScript, Go, Python or Rust.
- 2.Reject unsafe numbers by default, or infer their original number tokens as strings.
- 3.Generate, review the definitions and dependencies, then copy them into your project.
Limits and notes
- Sample inference is not a complete schema or runtime validator; empty-array item types are unknown.
- Up to 500,000 characters, 25,000 values and 40 nesting levels; root names are limited to 80 characters.
- Numbers beyond JavaScript safe precision are rejected by default; string inference preserves original tokens. Decimal, exponent and negative-zero forms are conservatively widened.
- Go optional, nullable and union fields use json.RawMessage to preserve missing versus null. Unsupported struct-tag keys produce an explicit error.
- Python requires 3.11+. Rust requires serde (derive) and serde_json, with custom field deserialization to distinguish missing from null.
Frequently asked questions
Are missing fields different from null?
Missing sample fields become optional, while explicit null is inferred separately. Go RawMessage and custom Rust Serde field deserialization preserve that distinction.
Can large integers be rounded before inference?
Original number tokens are checked first. Unsafe numbers are rejected by default, or their original token text can be inferred as a string.