JSON to Swift Struct
Generate a Swift struct with Codable conformance from a JSON sample.
import Foundation
struct Root: Codable {
let id: Int
let name: String
let email: String
let score: Double
let active: Bool
let tags: [String]
let address: Address
}
struct Address: Codable {
let street: String
let city: String
}How JSON to Swift struct generation works
JSON types map to Swift: strings → String, integers → Int, decimals → Double, booleans → Bool, arrays → [T], and null values → optional types. All structs conform to Codable (bothEncodable and Decodable). CodingKeysare generated automatically when JSON keys don't match Swift camelCase naming.
For Kotlin equivalents, try JSON to Kotlin. For TypeScript, see JSON to TypeScript.
Private & free — this tool runs entirely in your browser.
Recommended: IndieKit — Ship your Next.js startup in days.affiliate
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to CSV
Flatten a JSON array of objects into CSV rows.
CSV to JSON
Parse CSV with headers into a JSON array of objects.
JSON to XML
Convert JSON structures into nested XML markup.
JSON Minifier
Strip whitespace to produce compact JSON.
JSON to TypeScript
Generate TypeScript interfaces from a JSON sample.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.