Skip to main content
${format:vault}

JSON → TypeScript

JSON Input
Tab inserts an indent. Press Escape, then Tab, to move focus out of the editor.
TYPESCRIPT Output

Why use a private JSON to TypeScript converter?

Generating TypeScript interfaces from JSON payloads helps you type API responses without writing types by hand. This converter runs entirely in your browser — no data is uploaded or transmitted, making it safe for internal API schemas.

How it works

The converter analyses the JSON structure recursively, infers the TypeScript type for each field (string, number, boolean, null, array, or nested interface), and generates named interfaces. Optional fields are detected when a key appears in some objects but not all. Arrays of mixed types produce union types.

Common use cases

  • Generating TypeScript types for REST API responses without writing them by hand
  • Typing GraphQL response payloads for use in React components
  • Converting JSON Schema definitions to TypeScript interfaces
  • Bootstrapping type definitions when integrating a new third-party API
  • Converting internal JSON configs to typed TypeScript objects

Frequently asked questions

Is my data safe to convert here?
Yes. All conversion happens in your browser. No data is transmitted to any server.
How are optional fields detected?
If a key appears in some objects in an array but not all, it is marked as optional (?) in the generated interface.
Are nested objects supported?
Yes. Nested objects generate nested named interfaces. The root interface is named Root by default but you can change it.
What happens with arrays of mixed types?
Mixed-type arrays generate union types, e.g. (string | number)[].

Related tools