JSON to TypeScript
Infer a TypeScript type from a sample JSON value.
Runs on your device. Nothing you add is uploaded.
TypeScript type
export type Root = {
station: string;
readings: Array<{
celsius: number;
hour: string;
}>;
active: boolean;
};How to use JSON to TypeScript
- Paste a JSON value.
- Review the tool output or fix the first error shown.
- Copy the result or continue exploring the JSON.
Questions
How does this tool handle the input?
Mixed arrays produce a union of the element shapes. Empty arrays become unknown arrays. Fields are inferred from the sample.
Where is my input processed?
On your device. The tool does not upload the input or its result.
How this works
Parses strict JSON with a local syntax tree that retains the position and original spelling of each token.
Everything happens in this browser tab. What you type or add stays on your device, and the page has no tracking. Your last settings are kept in this browser so the tool opens the way you left it. Privacy
Related tools
More in DeveloperJSON Formatter
Indent JSON so objects and arrays are easy to read.
JSON Validator
Check JSON syntax and locate the first problem by line and column.
JSON Viewer (Tree)
Explore JSON objects and arrays in a collapsible tree.
JSON Sorter
Sort JSON object keys recursively and keep arrays in their original order.