GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • quicktype
  • GitHub13.9k
  • Blog
  • MCP
  • Open App
  • Twitter
  • YouTube

This view

  • Original page
  • New address

GeezerVison is showing quicktype.io — Turn JSON into typesafe code in any language.

Turn JSON into typesafe code in any language.

quicktype infers types from your JSON and generates models, serializers, and validators in more than 25 languages. Millions of developers have generated billions of lines of code with it, and more than 200 contributors have contributed to its open source project. Use it in the browser, from the command line, in your build pipeline, or hand it to your AI coding agent over MCP.

Open AppAdd to your AI agent

quicktype is fluent in

  • C
  • C#
  • C++
  • Crystal
  • Dart
  • Effect Schema
  • Elixir
  • Elm
  • Flow
  • Go
  • GraphQL
  • Haskell
  • Java
  • JavaScript
  • JSON Schema
  • Kotlin
  • Objective-C
  • PHP
  • Pike
  • Python
  • Ruby
  • Rust
  • Scala
  • Smithy
  • Swift
  • TypeScript
  • Zod

Pick a language to try it in your browser.

  1. 01Start with data

    {
      "people": [
        { "name": "Atticus",
          "high score": 100 },
        { "name": "Cleo",
          "high score": 900 },
        { "name": "Orly" },
        { "name": "Jasper" }
      ]
    }

    Sample JSON, an API URL, a JSON Schema, or a GraphQL query: whatever you have.

  2. 02quicktype infers the types

    class MyData {
      people: Person[];
      
      static fromJson(json: string) {…}
    }
    
    class Person {
      name: string;
      highScore: int?;
    }

    You get models, serializers, and validators in your language, named and typed sensibly.

  3. 03Ship typesafe code

    let data = MyData.fromJson('{
      "people": [ { "name": "Olivia" } ]
    }')
    
    for person in data.people {
      print(person.name)
      person.highScore++
    }
    
    highScore may be undefined

    Your compiler, your IDE, and your AI agent can now all reason about the data.

repo.json
{
  "owner": {
    "login": "ada"
  },
  "pull_requests": [
    {
      "title": "Add types",
      "merged": true
    }
  ]
}
→
Repo.ts
export interface Repo {    owner:         Owner;    pull_requests: PullRequest[];}export interface Owner {    login: string;}export interface PullRequest {    title:  string;    merged: boolean;}

Nested objects become named types, named after the property they appear in, singularized and cased for the language: pull_requests becomes PullRequest. When two different shapes share a name, quicktype qualifies them by context: UserAddress and CompanyAddress.

car.json
{
  "class": "compact",
  "default": true,
  "model-year": 2024,
  "top speed (mph)": 130
}
→
Car.swift
struct Car: Codable {    let carClass: String    let carDefault: Bool    let modelYear: Int    let topSpeedMph: Int    enum CodingKeys: String, CodingKey {        case carClass = "class"        case carDefault = "default"        case modelYear = "model-year"        case topSpeedMph = "top speed (mph)"    }}

class and default are Swift keywords, and model-year and top speed (mph) aren't identifiers anywhere. quicktype gives each property a legal, idiomatic name and generates the serializer, here CodingKeys, that maps it back to the original JSON key.

two samples
// sample 1
{
  "name": "Alice",
  "lastSeen": null
}

// sample 2
{
  "name": "Bob",
  "lastSeen": "2018-03-08T10:30:00Z",
  "avatar": "bob.png"
}
→
User.ts
export interface User {    name:     string;    lastSeen: Date | null;    avatar?:  string;}

Give quicktype more than one sample and it merges what it learns. lastSeen appears in both but is sometimes null; avatar is missing from one, so it becomes optional. The more samples you provide, the more accurate the types.

cart.json
{
  "items": [
    { "sku": "A1", "qty": 2, "price": 3 },
    { "sku": "B2", "qty": 1, "price": 4.5 }
  ]
}
→
Cart.swift
struct Cart {    let items: [Item]}struct Item {    let sku: String    let qty: Int    let price: Double}

Every qty quicktype saw was a whole number, but one price wasn't, so qty becomes an Int and price a Double. TypeScript only has number, so this one is shown in Swift.

record.json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "2018-09-01T12:00:00Z",
  "website": "https://quicktype.io"
}
→
Record.cs
public partial class Record{    public Guid Id { get; set; }    public DateTimeOffset CreatedAt { get; set; }    public Uri Website { get; set; }}

In JSON these are all strings. quicktype recognizes the UUID, the ISO 8601 timestamp and the URL, and gives each the right type: Guid, DateTimeOffset and Uri. Swift gets UUID, Date and URL from the same sample; languages without such types keep the strings.

tickets.json
[
  { "id": 1, "priority": "high" },
  { "id": 2, "priority": "low" },
  { "id": 3, "priority": "high" },
  { "id": 4, "priority": "medium" },
  { "id": 5, "priority": "low" },
  { "id": 6, "priority": "high" },
  { "id": 7, "priority": "low" },
  { "id": 8, "priority": "medium" },
  { "id": 9, "priority": "high" },
  { "id": 10, "priority": "low" }
]
→
Ticket.ts
export interface Ticket {    id:       number;    priority: Priority;}export type Priority = "high" | "low" | "medium";

Ten tickets, but only three distinct priorities. quicktype notices that priority keeps repeating the same few strings and turns it into an enum. It waits for enough evidence first: a couple of samples never make an enum.

paper.json
{
  "title": "On Computable Numbers",
  "author": { "name": "Alan", "email": "[email protected]" },
  "coauthors": [
    { "name": "Alonzo", "email": "[email protected]" }
  ]
}
→
Paper.ts
export interface Paper {    title:     string;    author:    Author;    coauthors: Author[];}export interface Author {    name:  string;    email: string;}

author and each element of coauthors have the same shape, so quicktype generates a single Author type and uses it in both places rather than two identical interfaces with different names.

readings.json
[
  { "sensor": "temp", "value": 21.5 },
  { "sensor": "door", "value": "open" },
  { "sensor": "motion", "value": false }
]
→
Reading.ts
export interface Reading {    sensor: string;    value:  boolean | number | string;}

value is a number in one reading, a string in another, and a boolean in a third. Instead of giving up and calling it any, quicktype keeps every possibility it saw as a union type.

items.json
[
  { "id": 42 },
  { "id": "a1b2c3" },
  { "id": 7 }
]
→
Item.java, ID.java
public class Item {    private ID id;    public ID getID() { return id; }    public void setID(ID value) { this.id = value; }}public class ID {    public Long integerValue;    public String stringValue;}

id is sometimes a number and sometimes a string. Java has no union types, so quicktype builds one: an ID class with a field per possibility, exactly one of which is non-null. The generated Jackson deserializer checks the JSON token and fills in the right field; the serializer writes back whichever is set.

blockchain.json
{
  "blocks": {
    "000000000000000000c846dee2e13c6408f5": {
      "height": 503162,
      "time": 1515187634
    },
    "00000000000000000024fb37364cbf81fd95": {
      "height": 503163,
      "time": 1515188162
    }
  }
}
→
Blockchain.ts
export interface Blockchain {    blocks: { [key: string]: Block };}export interface Block {    height: number;    time:   number;}

Those keys don't look like property names; they look like data. quicktype scores every key against a Markov chain trained on real property names, and when they don't pass, the object becomes a map instead of a class with absurd properties.

user.json
{
  "login": "ada",
  "followers": 128
}
→
User.go
func UnmarshalUser(data []byte) (User, error) {	var r User	err := json.Unmarshal(data, &r)	return r, err}func (r *User) Marshal() ([]byte, error) {	return json.Marshal(r)}type User struct {	Login     string `json:"login"`	Followers int64  `json:"followers"`}

Types alone don't read JSON, so quicktype also writes the code that does: here encoding/json struct tags and UnmarshalUser / Marshal helpers, with no dependencies at all. Where a language has no JSON support built in, quicktype leans on the lightest library it can and generates the rest itself.

repo.json
{
  "name": "quicktype",
  "stars": 13000
}
→
Repo.py
@dataclassclass Repo:    name: str    stars: int    @staticmethod    def from_dict(obj: Any) -> 'Repo':        assert isinstance(obj, dict)        name = from_str(obj.get("name"))        stars = from_int(obj.get("stars"))        return Repo(name, stars)

Python, Ruby and JavaScript won't check types for you, so the generated code does it at the boundary: from_dict asserts that the input is an object, and the generated from_str and from_int helpers assert each field's type. Bad data fails where it enters, not somewhere deep in your program.

The Backwater, an oil painting by Charles William Wyllie of a woman on a riverbank watching a man in a punt
quicktype — zsh — 96×32
Install quicktype
$ npm install -g quicktype$ npm install -g quicktype
Turn a JSON file into TypeScript
$ quicktype user.json -o User.ts$ quicktype user.json -o User.ts
Or point it at a live API$ quicktype https://api.acme.dev/v1/orders -o Order.cs
$ quicktype -o Order.cs \    https://api.acme.dev/v1/orders
Pipe JSON in from anywhere$ curl -s https://api.acme.dev/v1/me | quicktype -l python -o user.py
$ curl -s https://api.acme.dev/v1/me \    | quicktype -l python -o user.py
Give it several samples for better types
$ ls samples/$ ls samples/
order-1.json order-2.json order-3.json
$ quicktype samples/ -o Order.swift$ quicktype samples/ -o Order.swift

The Backwater · Charles W. Wyllie, 1903

✳claudeOpus
✳ Welcome to Claude Code
cwd: ~/acme/storefront
mcp: quicktype · connected
❯Ask Claude to work on a task…
Claude Max · Opus~/acme/storefront

Connect the MCP server

One hosted endpoint, no API key. Add it to Claude Code, Cursor, Codex, or any MCP client, and your agent gets quicktype's type inference as a tool.

Add to CursorSetup for other MCP clients →
quicktype MCP
Add quicktype to Claude Code$ claude mcp add --transport http quicktype \    https://mcp.quicktype.io/mcp
$ claude mcp add --transport http \    quicktype \    https://mcp.quicktype.io/mcp
Or point any MCP client at the server URLhttps://mcp.quicktype.io/mcp

The old way

Hunt for a client library
A good one is gold, but most are outdated, unmaintained, or simply don’t exist for your language.
Write the types by hand, or have a chatbot guess
Slow, error-prone, and stale the moment the API changes. An LLM eyeballing a payload misses optional fields, mislabels numbers, and invents structure that isn’t there.
Read the data as dynamic, untyped values
Every field access is a runtime gamble, and neither your compiler, your IDE, nor your AI assistant can help you.

With quicktype

Generate the client code
Give quicktype sample responses and get idiomatic, strongly typed models and serializers in your app’s language, in seconds.
Regenerate when the API changes
Run quicktype in your build or CI. When the API changes, regenerate and let the compiler point you at exactly what to update.
Give your tools something to work with
Typed data unlocks autocomplete, refactoring, and validation in your IDE, and gives AI agents an accurate model of your data instead of a guess.

Add your lines to the ten billion.

Paste JSON and get perfect typesafe code in seconds, in the browser, in your terminal, or inside your AI agent.

Generate code nowAdd to your AI agentnpm install -g quicktype
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.