JSON to TypeScript
Paste a representative piece of JSON and get TypeScript interfaces back. Nested objects become their own named interfaces, arrays become typed arrays, and a field that holds more than one kind of value becomes a union.
It reads the shape of the sample, so the types are only as complete as the example. Where it has to guess, it says so rather than pretending. Nothing is uploaded.
TypeScript
Types are inferred from one sample, so treat them as a first draft: a field that is null in your example but a string in real data will come out as null. Nothing you paste is sent anywhere.
Questions
- Is what I paste sent anywhere?
- No. Every tool in this kit runs in the page itself. There is no server here that receives what you paste, and you can check it in your browser's network tab: using a tool produces no request carrying your input at all.
- How good are the generated types?
- As good as the sample. Types are inferred from one example, so a field that is null in your sample but a string in real data will come out wrong, and an empty array cannot say what it holds. Feed it a full, representative object and the result is close; treat it as a strong first draft to tidy, not a schema.
- How are mixed types handled?
- A field that holds different types across an array of objects, or that is sometimes null, becomes a union like string | number or string | null. An array of mixed values becomes an array of a union. This keeps the types honest about what the data actually contains.
- What are the limits?
- It infers, it does not validate: it cannot know a string is really a date or a union has a fixed set of values. Optional fields are detected only when a key is missing from some objects in an array. Anything it cannot pin down becomes unknown rather than a wrong guess.
The other tools here
- JSON formatter, format, minify and validate
- Base64 encoder, encode and decode, text or file
- URL encoder, encode and decode, two rules
- UUID generator, version 4, one to a hundred
- Hash generator, sha-256, sha-1 and md5 at once
- JWT decoder, header, payload and expiry
- Regex tester, live matches, groups and flags
- Text diff, compare two blocks, by line or word
- Timestamp converter, unix time to a date, and back
- Cron explainer, a schedule, in plain english
- Colour converter, hex, rgb, hsl, and a contrast check
- Markdown preview, live preview, and copy the html
- JSON to CSV, an array of objects into a spreadsheet
- Data file converter, csv, json and excel, in any direction
- JSON and YAML, convert between json and yaml, either way
- SQL formatter, tidy up sql, or minify it, by dialect
- Password generator, strong random passwords, made on your device
- Number base converter, hex, binary, decimal and octal, live
- curl converter, a curl command to fetch, axios or python