PasteZap
🌐 English
Free · No account

FREE · DEVELOPER TOOLS

JSON to Swift Codable.

Turn a JSON sample into Swift Codable structs with CodingKeys for snake_case keys, optionals and nested types.

Limits & supported formats

Types are inferred from the sample only. Everything is calculated in your browser; nothing you type is uploaded.

Loading the calculator…

How to use JSON to Swift Codable

Paste a JSON object or an array of objects and name the root type. Copy or download Models.swift.

How it works

Integers map to Int, decimals to Double, arrays to [T]; optional or null fields become optionals. A small JSONValue enum is added when a field’s type varies.

Example

user_name becomes let userName: String with case userName = "user_name" in CodingKeys.

Questions about JSON to Swift Codable

Is JSON to Swift Codable free, and do I need an account?

Yes. This tool is free to use in your browser without an account. Processing takes place on your device.

What are the limits and what should I check?

Types are inferred from the sample only. Everything is calculated in your browser; nothing you type is uploaded. Review the result before using it in your work.

Is my input sent to a server?

Your input is processed in your browser and is not uploaded by this tool. Files and pasted text are cleared when the page is refreshed. Normal website requests are still required to load the page and its libraries. Read the privacy explanation.