JSON to Types

Deeply nested JSON

Names are derived from the key path so deep structures stay legible, and the depth itself is flagged.

Input

{
  "org": {
    "team": {
      "project": {
        "settings": {
          "notifications": { "email": true, "slack": false }
        }
      }
    }
  }
}

An object with 5 nested shapes.

6 interfaces · 7 fields · 6 levels deep

Where this sample is ambiguous

  • Note

    Nested 7 levels deep

    A single sample is weak evidence at this depth — the deeper a shape, the more likely some branch varies in a way this payload does not show.

    Fix: Verify the deepest types against the source schema or a second sample.

TypeScript

export interface Root {
  org: Org;
}

export interface Org {
  team: Team;
}

export interface Team {
  project: Project;
}

export interface Project {
  settings: Setting;
}

export interface Setting {
  notifications: Notification;
}

export interface Notification {
  email: boolean;
  slack: boolean;
}

Zod

import { z } from 'zod';

export const NotificationSchema = z.object({
  email: z.boolean(),
  slack: z.boolean(),
});

export const SettingSchema = z.object({
  notifications: NotificationSchema,
});

export const ProjectSchema = z.object({
  settings: SettingSchema,
});

export const TeamSchema = z.object({
  project: ProjectSchema,
});

export const OrgSchema = z.object({
  team: TeamSchema,
});

export const RootSchema = z.object({
  org: OrgSchema,
});

Convert your own JSON

Paste a sample on the home page, or call the API or MCP server. This page is also available as markdown.

Related examples