JSON to Swift Codable Struct Generator
Generate Swift structs or classes from JSON. Turn off Types only to get Codable types with CodingKeys and convenience initializers for JSONDecoder.
How it works
- 1
Paste or open your data
Paste text, drop a file onto the editor or click Open file. Load sample shows how the tool works.
- 2
Adjust the options
The result updates as you type. Change the options to get exactly the output you need.
- 3
Copy or download
Copy the result to the clipboard or download it as a file.
Why PixNudge
Nothing is uploaded
Your data is processed in your browser and never sent to a server, so API keys, tokens and customer data stay private.
Instant, even for large files
There is no round trip to a server: results appear as you type, and files of several megabytes are handled smoothly.
Exact numbers
Long numbers such as 64-bit IDs are kept exactly as written instead of being rounded.
Frequently asked questions
Is the generated code Codable?
With Types only off, every type conforms to Codable and gets CodingKeys and initializers for decoding from Data or a JSON string. With Types only on, you get just the plain types.
Structs or classes?
Structs are generated by default, as recommended for Swift models. Turn on Use classes instead of structs if you need reference types.
How are optional values handled?
Keys that are missing from some items or can be null become optionals, such as let coupon: String?.