Skip to main content
CuteJSON
↑↓ Navigate Enter Select Esc Close

JSON to TypeScript

Turn a document you already have into TypeScript interfaces, Python dataclasses, Go structs or Rust structs you can paste into a project.

Back to all tools

Keyboard shortcuts

These work wherever the matching action exists on this page.

Open the command palette
Ctrl/Cmd + K
Run the main action
Ctrl/Cmd + Enter
Format
Ctrl/Cmd + Shift + F
Minify
Ctrl/Cmd + Shift + M
Copy output
Ctrl/Cmd + Shift + C
Open file
Ctrl/Cmd + Shift + O
Download output
Ctrl/Cmd + S
Close this dialog
Esc
Open this dialog
F1 / ?

Local data

Everything below is stored only in this browser, on this device. None of it is ever sent anywhere, and closing this dialog is not required for that to stay true.

Unsaved drafts
Tools with remembered options

Recently opened files

    No files opened yet on this device.

    Share via link

    The content is packed into the part of the link after the # sign, which browsers never send to a server. Nothing here is uploaded to cutejson.com or anywhere else.

    Shares the first input on this page. On a tool with more than one, only that one is included.

    Nothing to share yet. Paste or type something first.

    Input

    Load from a URL

    Fetches the URL directly from your browser and loads whatever text it returns into this pane.

    Output

    The result appears here.

    Runs entirely in your browser. Nothing you paste is uploaded, and you can confirm that in your browser Network tab.

    About this tool

    The types come from the same inference the schema generator uses, so the two pages agree about your document and differ only in how they write it down. A nested object becomes a named type rather than an inline one, because an inline type three levels deep is unreadable and nothing else can refer to it. Names come from the key that holds the value, singularised inside an array, and a name that is already taken gets a number so the output always compiles. A key missing from any record is marked optional with a question mark. An empty object becomes a record of unknown rather than an empty interface, and an empty array becomes an array of unknown, since the sample says nothing about what would have been inside. Numbers are all number, because TypeScript has no integer type. Switching the output language to Python writes the same inferred shape as dataclasses instead: a nested object becomes a nested class, named and de-duplicated the same way, and a field missing from some records becomes Optional with a None default, ordered after every field that is always present, since Python requires that order. Python keeps int and float separate, unlike the TypeScript output. Switching to Go writes the same shape as structs instead, each field carrying a json struct tag with the original key, so the generated code marshals back to exactly the document it came from. A field missing from some records, or sometimes explicitly null, becomes a pointer with an omitempty tag where that actually matters, since Go already treats a missing slice or map as nil without one. Go also keeps whole numbers and fractions separate, as int64 and float64. Switching to Rust writes structs with serde derives: fields are snake_cased with a serde rename attribute whenever that differs from the original key, a field missing from some records becomes Option with skip_serializing_if so it round-trips as missing rather than null, and a Rust keyword that happens to be a JSON key, like type, is escaped as a raw identifier so the output still compiles.

    How to use

    1. Paste a document, or several records in an array, into the input pane.
    2. Pick an output language and a root name, adjust its options, then press Generate types.
    3. Copy the declarations or download them as a file.

    Keep reading

    How to convert JSON to TypeScript interfaces Read the guide