---
title: Generate TypeScript, Go, and Rust Types from JSON | Prettify Docs
description: Generate TypeScript, Go, Kotlin, Rust, or JSON Schema types from a
  JSON or YAML document. Powered by quicktype and free in Prettify.
url: https://prettify.tools/docs/type-generation
---

[Docs](https://prettify.tools/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](https://prettify.tools/app/editor).

## 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.

| Target      | File 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](https://prettify.tools/docs/json-schema)
- [JSON](https://prettify.tools/docs/json) and [YAML](https://prettify.tools/docs/yaml)
- [Transforms: Sort Keys and Reshape Data](https://prettify.tools/docs/transforms)

## Try it online

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

- [JSON to TypeScript](https://prettify.tools/json-to-typescript)
- [JSON to JSON Schema](https://prettify.tools/json-to-schema)

* [PreviousTransforms](https://prettify.tools/docs/transforms)
* [Next JSON Schema validation](https://prettify.tools/docs/json-schema)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Prettify",
  "url": "https://prettify.tools",
  "description": "Multi-format data viewer, editor, and query engine for JSON, YAML, CSV, XML, Mermaid, Markdown, MDX, HTML, and SVG",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Web, macOS, Windows, Linux",
  "offers": [
    {
      "@type": "Offer",
      "price": "0",
      "priceCurrency": "USD",
      "description": "Free tier with core features"
    },
    {
      "@type": "Offer",
      "price": "19.99",
      "priceCurrency": "USD",
      "description": "Pro: lifetime access to all features"
    }
  ],
  "publisher": {
    "@id": "https://prettify.tools/#organization"
  }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://prettify.tools/#organization",
  "name": "Prettify",
  "legalName": "Off Leash Labs",
  "url": "https://prettify.tools/",
  "logo": {
    "@type": "ImageObject",
    "url": "https://prettify.tools/icon-512.png",
    "width": 512,
    "height": 512
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer support",
    "email": "offleashlabs@gmail.com",
    "availableLanguage": "English"
  }
}
```
