JSON to Swift Structs

Instantly convert any JSON payload into Codable Swift model structs.

About JSON to Swift Structs

When building iOS or macOS applications in Swift, the most common task is decoding JSON API responses into native model objects. Swift's Codable protocol makes this straightforward, but writing the boilerplate structs by hand is tedious and error-prone, especially for large, deeply nested payloads. This tool performs that conversion automatically, handling nested objects by generating multiple Codable structs, correctly mapping snake_case JSON keys to camelCase Swift properties, and inferring the correct Swift types (String, Int, Double, Bool, and arrays).

How to Use This Tool

  1. Paste Your JSON: Copy a JSON response from your browser's DevTools or Postman and paste it into the left panel.
  2. Review Generated Structs: The right panel will instantly display the generated Swift struct definitions.
  3. Handle Nested Objects: Any nested JSON objects will produce their own named structs automatically.
  4. Copy and Paste: Click "Copy" to copy all the generated code, then paste it directly into your Xcode project.