i♥MyFiles. My Tools
Developer tools

JSON to TypeScript & Zod

Turn a representative JSON sample into TypeScript interfaces and Zod schemas. Inference is based on the sample, so review optional fields and unions against your real API data before shipping.

Runs in your browser - files are never uploaded
Developer tools

JSON to TypeScript & Zod

Generate TypeScript interfaces and Zod schemas from a JSON sample.

← All tools
Drop files here, or browse

Choose files from your device

Preview
Confirm metadata removal

This edits document properties only; page content, links, annotations and forms are preserved where the PDF engine supports it. Some metadata structures (for example extended XMP written by other editors) may not be fully removed. Your original file is not changed - a separate cleaned PDF is created.

Example: generated output

From a sample object containing nested data, a mixed array and a nullable field:

TypeScript

export interface ApiExampleCandidateProfile {
  country: string;
  verified: boolean;
}

export interface ApiExampleCandidate {
  id: number;
  displayName: string;
  active: boolean;
  roles: string[];
  profile: ApiExampleCandidateProfile;
}

export interface ApiExample {
  candidate: ApiExampleCandidate;
  audit: null;
}

Zod

import { z } from 'zod';

export const ApiExampleCandidateProfileSchema = z.object({
  "country": z.string(),
  "verified": z.boolean(),
});

export const ApiExampleCandidateSchema = z.object({
  "id": z.number(),
  "displayName": z.string(),
  "active": z.boolean(),
  "roles": z.array(z.string()),
  "profile": ApiExampleCandidateProfileSchema,
});

export const ApiExampleSchema = z.object({
  "candidate": ApiExampleCandidateSchema,
  "audit": z.null(),
});

export type ApiExample = z.infer<typeof ApiExampleSchema>;

Generated types reflect only supplied sample data. Check optionality and mixed types against representative inputs.

How to use it

  1. Paste one JSON object or array of objects.
  2. Choose a root type name and optional-field behavior.
  3. Generate, review, copy or download the TypeScript and Zod code.

Frequently asked questions

Can one example reveal every optional field?

No. Fields missing from the provided sample cannot be inferred; provide representative samples or edit the generated output.

Does it support nested data?

Yes, nested objects and arrays are recursively converted. Mixed sample types are represented as unions where possible.

Is the sample uploaded?

No. Generation runs locally.