Skip to tool

JSON to Swift Structs

Generate Swift structs from JSON.

How to Use This Tool

  1. Paste JSON.
  2. Set a root struct name.
  3. Click Generate Structs.

Learn More About JSON to Swift Structs

Why Swift structs?

Swift structs with Codable make JSON decoding safe and concise in iOS apps.

About JSON to Swift Structs

Swift structs model JSON data in iOS apps. This tool creates Codable struct definitions from JSON samples quickly.
Create Swift structs from JSON.
Runs in browser
Yes
Output
Swift
Codable
Yes

Examples

Generate Swift structs

Convert JSON into Swift models.
Input
{"id":1,"name":"Ava"}
Output
struct Root: Codable {
  let id: Int
  let name: String
}

Features

Swift output

Generates Codable structs.

Type inference

Infers String, Int, Double, Bool, and arrays.

Nested structs

Creates nested struct definitions automatically.

Use Cases

  • Model API responses in iOS apps.
  • Generate Swift DTOs quickly.
  • Prototype Swift data models.

Frequently Asked Questions

Generate Kotlin data classes or TypeScript interfaces using related tools.