Start a project

Tool 245 of 425 · Swift

JSON to Swift Codable

Writes ready-to-paste Swift Codable models, with nested structs and a decoder set-up, from sample JSON.

JSON to Swift Codable

Your input

Result

Swift

    01

    What it does

    Writes ready-to-paste Swift Codable models, with nested structs and a decoder set-up, from sample JSON.

    • Nested structs and arrays
    • CodingKeys or convertFromSnakeCase
    • Date and URL detection
    • Optional, Hashable and class options

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Swift source, with a Copy and a Download button on every result.

    • Swift
    • Codable
    • iOS

    Why it matters

    Hand-writing Codable models for a large API response is slow and one wrong type crashes decoding.

    Paste a real response and get models with the right types and keys.

    How to use it

    1. Type or paste your input; the example shows the format.
    2. Press Generate Swift. Results also update as you type.
    3. Read the summary line, then the table, notes or output below it.
    4. Copy or download what you need. Nothing leaves this page.

    FAQ

    Why are some properties optional?

    When Make optional is on, or a value is null in the sample.

    Does it handle arrays of mixed objects?

    It merges keys from every item, so fields missing in some become optional.

    Is my input uploaded?

    No. The tool runs in your browser and nothing you type, paste or open is sent anywhere.

    Can I rely on the result?

    It follows the public specification or formula named on this page and says where it simplifies. Check anything critical against the official tool or documentation before you ship it.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk