Skip to main content

JSON to Swift

New

Generate Swift Codable structs from JSON data.

convertswiftcodable
Read the guide
Shortcuts:⌘ KSearch
Properties are normalized to camelCase.
CodingKeys blocks are emitted only when needed.

Frequently Asked Questions

Why did it generate a CodingKeys enum for some structs but not others?

CodingKeys is emitted only when the camelCased Swift property name differs from the original JSON key. If the names already match, no CodingKeys block is added.

Why are some unknown fields typed as String with comments?

When the tool cannot infer a stable concrete type, it falls back to String and leaves a comment like // Fallback type. A null-only field falls back to String?.

What does it do with empty arrays?

An empty array becomes [String] with an inline // Empty array fallback comment. It does not emit [Any] or a custom placeholder type.

Are the generated models Codable?

Yes. Every generated struct conforms to Codable.

Does it create separate structs for nested objects?

Yes. Nested objects become their own structs, while a primitive or array root becomes a typealias.

Related Tools