quicktype

Generate strongly-typed models and serializers from JSON, Schema, TypeScript, or GraphQL

Tool
npm
v26.0.0
13,841stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
84/100Excellent
Development Activity96
Maintenance72
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality78
Innovation82
Learning Curve75

quicktype is a CLI and library that infers types from sample JSON, JSON Schema, TypeScript interfaces, or GraphQL queries, then emits idiomatic, strongly-typed model and serialization code in over 20 target languages including TypeScript, Swift, Kotlin, C#, Go, Rust, and Java. Instead of hand-writing boilerplate for parsing and validating JSON payloads, teams point quicktype at real data or a schema and get ready-to-use types plus (de)serializers that match each language’s idioms.

Used both as a global CLI (npm install -g quicktype) and as an embeddable library via the quicktype-core package, it fits into build pipelines where a JSON schema is committed to a repo and model code is regenerated for every platform (iOS, Android, web, backend) on every build, keeping cross-language data contracts in sync automatically.

What You Get

  • A global CLI (quicktype) that reads JSON, JSON Schema, TypeScript, or a live API URL and writes typed model code
  • The quicktype-core library for embedding the same inference and code-generation pipeline in your own Node.js or browser tooling
  • Code generators for 20+ languages: TypeScript, Swift, Kotlin, C#, Go, Rust, Java, Python, Dart, C++, Scala, Elm, and more
  • A JSON-Schema-first workflow: infer a schema once, commit it, then regenerate matching models for every platform on every build
  • GraphQL query input support via the quicktype-graphql-input package for typing GraphQL responses
  • A hosted playground at app.quicktype.io for trying inputs and languages without installing anything

Common Use Cases

  • Generating matching data models for iOS (Swift), Android (Kotlin), and web (TypeScript) clients from one shared JSON Schema
  • Bootstrapping typed models quickly by pasting a sample JSON API response instead of writing types by hand
  • Keeping backend and frontend serialization code in sync by regenerating types whenever an API schema changes
  • Converting an existing TypeScript interface into equivalent types for other languages in a polyglot codebase

Under The Hood

Architecture - quicktype is an npm workspace monorepo where the root quicktype package is a thin CLI (src/index.ts) that wires input readers to quicktype-core, the engine that does the real work: input sources (JSON samples, JSON Schema, TypeScript, GraphQL via quicktype-graphql-input) are parsed into a shared TypeGraph intermediate representation (Graph.ts, DeclarationIR.ts, UnifyClasses.ts), which is then rewritten and pruned (GraphRewriting.ts, MakeTransformations.ts) before being handed to a per-language Renderer/TargetLanguage (Renderer.ts, TargetLanguage.ts, the language/ directory) that emits idiomatic source text for the chosen target. This IR-based pipeline is what lets one input format map cleanly to 20+ output languages without N×M bespoke converters.

Tech Stack - Written in TypeScript on Node.js 20+, built with tsc across workspace packages (quicktype-core, quicktype-graphql-input, quicktype-typescript-input, quicktype-vscode), linted/formatted with Biome, and tested with Vitest for unit tests plus a shell-driven fixture suite (script/test, test/fixtures) that runs generated output through each target language’s own toolchain. Runtime dependencies are minimal and focused (chalk, command-line-args, graphql, lodash, readable-stream), keeping the published CLI package lean.

Code Quality - The project separates concerns cleanly between CLI plumbing (root src/), the reusable engine (quicktype-core/src), and language-specific renderers, which keeps the addition of new target languages contained. Naming inference and markov-chain-based heuristics (EncodedMarkovChain.ts, GatherNames.ts) are isolated into dedicated modules rather than scattered through renderers. Testing is substantial: unit tests via Vitest plus an extensive fixture-based integration suite that actually compiles/runs generated code per language, which is a strong signal for a code-generation tool since it validates real output, not just internal data structures.

API Design - The public quicktype-core API centers on a small number of composable primitives (InputData, jsonInputForTargetLanguage, JSONSchemaInput, the top-level quicktype() function), so a caller builds an InputData, adds one or more typed inputs, and calls quicktype({ inputData, lang }) to get back generated lines — a low-boilerplate, promise-based entry point. The library also exports a LanguageName union type with an isLanguageName runtime guard specifically to keep language-selection type-safe when the name comes from untrusted runtime input (CLI args, config), which is a thoughtful ergonomic detail for a TypeScript-first consumer.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search