Skip to content
Marvin's Toolbox.

Search tools

Type to filter all tools

JSON to TypeScript Converter

Paste JSON and get matching TypeScript types, with interfaces or type aliases, optional readonly fields and comments showing example values detected in your data. Nested objects become their own named types.

Everything runs locally in your browser. Your data never leaves your device.

Options

Drop a .json file here or click to browse. You can also paste below.
3 types

Next steps

Keep going. These tools open with your result loaded in.

Format code in JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, LESS, Markdown, YAML, GraphQL, XML and SQL. Pick tabs or spaces, set the indent width, and format the input in place with one click.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more, each with its own copy button.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

Paste a UUID to see what it carries: version, variant, and for time-based versions the exact timestamp, clock sequence and node. Also shows the raw bytes, the 128-bit integer and the URN form.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.

About the JSON to TypeScript Converter

This tool turns a JSON sample into TypeScript types you can paste straight into your code. Give it an API response or a config file and it writes matching declarations, with optional fields, unions and named types for nested objects all worked out from the data.

Each field can carry a comment showing an example value from your input, so the generated types double as documentation. Strings that look like UUIDs, emails, URLs or ISO dates are labelled as such.

What you can do

  • Generate TypeScript interfaces or type aliases from JSON.
  • Detect optional fields from arrays of objects with missing keys.
  • Turn nested objects into their own named types, with identical shapes sharing one declaration.
  • Annotate every field with an example value and detected formats like UUIDs, emails and dates.
  • Infer union types for fields that mix strings, numbers or null.
  • Set the root type name and add export or readonly to every declaration.

How to use the JSON to TypeScript Converter

  1. 1Paste your JSON into the input, drop a .json file, or forward data from another tool.
  2. 2Pick interfaces or type aliases and set the root type name.
  3. 3Toggle export, readonly, example comments and inline nested objects to taste.
  4. 4Copy the generated TypeScript or download it as a .ts file.

Types from a sample, not a schema

The generator reads your example data and infers the widest type it justifies. A key missing from some records of an array becomes optional, a field that is sometimes a number and sometimes a string becomes a union, and whole numbers mixed with decimals widen to number. A field that is null in every record stays null, with a comment reminding you to widen it once you know the real type.

Named types with example comments

Nested objects are hoisted into their own declarations named after their key, so a billing_address object becomes a BillingAddress type and an array under projects becomes Project[]. Structurally identical objects share one declaration instead of repeating it. With example comments on, each field shows a value taken from your data, truncated when long, so you can read the type and the data side by side.

Standard JSON only

The input must be valid JSON, the same as your code would parse. Comments, trailing commas and single quotes are not accepted, and an invalid document shows the error with its line and column. To explore the data itself first, use the JSON Inspector. To restyle the generated code, send it to the Code Formatter.

Convert config and data between JSON, YAML, TOML, JSON5, INI, XML, CSV and .env. Type or paste on the left, pick the output format on the right, and copy the result. Includes a format button and a minify toggle.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert a color between HEX, RGB, HSL, HSV, HWB, CMYK, OKLCH and OKLAB. Type into any field and the others update as you go, or pick the color visually. Reads CSS color syntax and keeps alpha where the format supports it.

Convert between px, rem, em, percent, pt and viewport units with a configurable root font size. Type into any field and the others update as you go, set the parent font size for em math, and read a conversion table for common sizes.

Escape text into HTML entities or decode entities back to plain text. Choose named or numeric entities, escape only the unsafe characters or everything outside ASCII, and read the result live.

Compare two JSON documents by structure and see every added, removed and changed key and value with its exact path. Browse the result as a tree, a filterable change list or a line diff, ignore array order, catch type changes and export the changes as a JSON report.