Swift Struct to JSON Schema Generator

Need JSON to Swift?

Convert JSON data to Swift code

JSON → Swift Structs

Swift code Input

Loading...

JSON Schema Output

Paste your Swift models to produce JSON Schema instantly.

Supports Codable structs, optional types, arrays, dictionaries, and nested models.

Frequently Asked Questions

Which Swift types are supported?

The tool parses structs and classes with stored properties. It handles optional types (String?), arrays, dictionaries, default values, Codable annotations like @CodingKey (ignored but safe), and nested types. Paste models directly from your Swift or SwiftUI project.

How are Swift types mapped to JSON Schema?

String/Int/Double/Bool map to schema primitives, arrays like [Address] become schema arrays, dictionaries map to objects, and optional types become optional fields. Unknown custom types fall back to strings unless another struct/class with that name exists in the input.

Can I include multiple structs?

Yes. Paste several related structs and choose the root type from the settings dropdown. Everything runs locally in your browser, so no source code is uploaded.

How do I create mock JSON data?

After generating the schema, click "Generate Mock Data" to open the Mock Generator with your schema preloaded. Configure locales, array counts, and optional fields to create sample payloads instantly.