JSON to Swift

Paste JSON and get matching Swift Codable structs, with nested types and optional fields inferred automatically.

JSON Input

Paste JSON on the left and click Generate Swift

Copied!

Summary

Paste JSON and get matching Swift Codable structs, with nested types and optional fields inferred automatically.

How it works

  1. Paste a JSON object or array in the left panel.
  2. Set a root type name and pick your struct options.
  3. The tool parses the JSON and infers a Swift type for every field.
  4. Nested objects and arrays of objects become their own Codable structs.
  5. Copy the generated Swift code with one click.

Use cases

  • Turn an API response sample into Codable structs for an iOS app.
  • Scaffold Swift models before writing full networking code.
  • Check whether a JSON payload maps cleanly to strict Swift types.
  • Generate CodingKeys for JSON that uses snake_case keys.
  • Prototype a Swift model from a JSON fixture used in tests.

Frequently Asked Questions

Last updated: 2026-07-23 · Reviewed by Nham Vu