PrettifyPrettify
DocsHome
Getting started
  • Getting started
Formats
  • JSON
  • JSONL and NDJSON
  • YAML
  • CSV and TSV
  • XML
  • RSS and Atom feeds
  • Mermaid
  • Markdown
  • MDX
  • HTML
  • SVG
Views
  • Views overview
  • Diagram view
  • Chart view
Queries
  • jq queries
  • SQL queries
  • XPath queries
Editing tools
  • Search and replace
  • Format conversion
  • Transforms
  • Type generation
  • JSON Schema validation
  • Diff and compare
  • Split view
Your documents
  • Tabs
  • History and versions
  • Sharing
  • Privacy and your data
Desktop app
  • Desktop app
  • Keyboard shortcuts
Pro
  • Prettify Pro
Help
  • Troubleshooting

Docs / Editing tools

Type generation

Last updated: October 16, 2026

Generate Types turns a JSON or YAML document into type definitions for your code. It is powered by quicktype and runs on your device. Type generation is free in Prettify.

Generate types from your data

Load a JSON or YAML document, then open the tool.

  1. Load JSON or YAML in the editor.
  2. Click Generate Types in the toolbar, under the Transform group.
  3. Pick a target language from the tabs.
  4. Copy the result, or download it as a file.

You can also open the Command Palette with Cmd+K (Mac) / Ctrl+K (Windows, Linux) and choose Generate Types. The tool reads the current document, so the types match the data you see.

Target languages

Prettify generates these targets. The download file uses the extension shown.

TargetFile extension
TypeScript.ts
Go.go
Kotlin.kt
Rust.rs
JSON Schema.schema.json

Each target uses idiomatic defaults.

  • TypeScript: interfaces only, with no runtime helpers.
  • Go: structs with json field tags and a package declaration.
  • Rust: structs that derive serde Serialize and Deserialize, plus Debug and Clone.
  • Kotlin: data classes.
  • JSON Schema: a schema that describes the sample.

Name the root type

The Root type field sets the name of the top-level type. Prettify fills it from the document or tab name, and you can edit it. A name that starts with a digit gets a Type prefix, and an empty name becomes Root.

Notes

Generate Types works on JSON and YAML only. The tool infers types from one sample, so a wider sample gives more accurate optional fields and unions. Large or high-precision numbers are passed to quicktype as valid JSON numbers.

Related

  • JSON Schema validation
  • JSON and YAML
  • Transforms: Sort Keys and Reshape Data

Try it online

Tool pages for this topic. Each one runs in your browser.

  • JSON to TypeScript
  • JSON to JSON Schema
PreviousTransformsNext JSON Schema validation
On this page
  • Generate types from your data
  • Target languages
  • Name the root type
  • Notes
  • Related
Prettify·Home·All docs·Contact·Changelog·Open app·llms.txtPermalink