SimplyScan logoSimplyScan
What We ScanPricingFree ToolsBlogCreate AccountLog In
  1. Home
  2. Free Tools
  3. JSON to TypeScript
Free Tool · Runs in your browser

Free JSON to TypeScript Converter

Convert a JSON payload into TypeScript interfaces · nested objects and arrays included · ready to paste into your codebase.

100% client-side · nothing you enter is ever sent to a server or stored.

Preview · sign in with a free account to run it

Nested objects become named interfaces · identical shapes are deduplicated · array elements are merged, with keys missing from some elements marked optional.

How to use it

  1. Paste a JSON sample, ideally a real API response with every field filled in.
  2. Set the root interface name, for example User.
  3. Copy the interfaces. Nested objects become their own interfaces, and array item names are singularised.

Example

Input

{"id":42,"name":"Ada","tags":["admin","beta"],
 "address":{"city":"London","zip":null},
 "orders":[{"id":1,"total":9.99},{"id":2,"total":24,"coupon":"BF26"}]}

Result

export interface User {
  id: number;
  name: string;
  tags: string[];
  address: Address;
  orders: Order[];
}

export interface Order {
  id: number;
  total: number;
  coupon?: string;
}

export interface Address {
  city: string;
  zip: null;
}

How types are inferred

Optional fields (?)
A key that appears in some array items but not others becomes optional, like coupon above.
null
A field that is null in the sample is typed null. Replace it with the real type, such as string | null.
Arrays
Objects in an array are merged into one interface. Mixed primitives become a union, such as (string | number)[].
Names
orders becomes Order and address becomes Address. Rename anything that reads oddly.

Go deeper

  • How do you validate request data with Joi schemas?

Page updated 21 November 2026

Frequently asked questions

How are arrays with mixed types handled?

Element types are unioned · an array of strings and numbers becomes (string | number)[]. Objects across array elements are merged, and keys missing from some elements are marked optional.

Why type API responses at all?

Untyped responses are where runtime bugs hide: a renamed field fails silently until production. Generated interfaces give the compiler a chance to catch drift · pair them with runtime validation (like zod) for full safety.

Are these types checked at runtime?

No. TypeScript types disappear when the code is compiled. To check untrusted input at runtime, use a validator such as Zod or Joi.

Want the full picture?

This tool covers one narrow check. A full SimplyScan runs 60 checks across 14 categories · exposed keys, RLS, XSS, auth, and speed · in 30 seconds.

Run a full security scan

Related tools

CSV ↔ JSON Converter

Convert between CSV and JSON in either direction · with proper handling of quoted fields, commas inside values, and headers.

Base64 Encoder / Decoder

Encode text to Base64 or decode it back · with full UTF-8 support. Handy for inspecting tokens, data URIs, and encoded config.

URL Encoder / Decoder

Encode or decode percent-encoded URLs · with separate modes for full URLs and individual query components.

SimplyScan logoSimplyScan

Security Scanner for Vibe-Coded Apps.

Product

See What We ScanHow It WorksView Pricing

Resources

Security BlogSecurity ChecklistTrust BadgeUptime MonitoringIntegrationsMCP Server (Claude, Cursor & Windsurf)API DocumentationBackend Audit GuideThreat Detection GuideFAQTerms of ServicePrivacy Policy

Platforms

All platforms →Lovable ScannerBolt.new ScannerCursor ScannerReplit Scannerv0.dev ScannerWindsurf ScannerBubble Scanner

Free Tools

All free tools →SSL CheckerSecurity HeadersDNS Security CheckerCORS TesterJWT DebuggerCSP EvaluatorHash GeneratorSEO Checker

Account

Create AccountLog In

© 2026 SimplyScan. All rights reserved.