Youtilities

JSON to Swift Codable

Generate Swift Codable structs with CodingKeys from any JSON.

Runs in your browser. Nothing is uploaded.

Input

Waiting for JSON

Swift
Swift types appear here.

What this does

Paste JSON and get Swift structs that conform to Codable, ready for JSONDecoder. Nested objects become their own structs; arrays of objects are merged into one struct.

Optionals

A key that is missing from some items, or sometimes null, becomes an optional such as String?. Whole numbers are Int, decimals Double. Values with no clear type use AnyCodable, a small community package, since Codable has no Any.

Names

Properties are camelCase. When that differs from the JSON key (first-name → firstName) a CodingKeys enum maps it back. Two objects with the same shape share one struct.

All