The quicktype command-line interface is the most powerful way to use quicktype. It can process multiple JSON files, fetch data from URLs, and generate a unified set of types for your entire application.
Installation
npm install -g quicktype
Basic Usage
Generate types from a JSON file:
quicktype data.json -o Types.swift
Generate types from a URL:
quicktype https://api.example.com/data -o Types.ts
Multiple Sources
One of quicktype's most powerful features is combining multiple JSON sources into a unified type system:
quicktype user.json posts.json comments.json -o Models.cs
quicktype will analyze all the JSON files and unify common types automatically.
Fetching from APIs
quicktype can fetch JSON directly from APIs:
quicktype \
"https://api.github.com/users/quicktype" \
"https://api.github.com/repos/quicktype/quicktype" \
-o GitHub.swift
Options
Use quicktype --help to see all available options, including:
--lang- Target language (swift, typescript, csharp, etc.)--top-level- Name of the top-level type--just-types- Output only type definitions--src-lang- Source language (json, schema, graphql)
From JSON Schema
quicktype also supports JSON Schema as input:
quicktype --src-lang schema schema.json -o Types.java
This gives you precise control over the generated types.