Advertisement

JSON to ObjC Model

Generate Objective-C model interfaces from JSON. Get @interface blocks with typed properties, NSNumber wrappers, and nested model classes.

JSON input

Paste JSON, optionally name the root type, then generate.

Your Objective-C model code will appear here.
Advertisement

Models for legacy iOS codebases

Millions of lines of Objective-C still ship in the App Store. This generator converts JSON API responses into @interface declarations with the property attributes (nonatomic, strong, copy) that codebase conventions expect.

Pair with NSJSONSerialization

Parse with NSJSONSerialization, then map dictionaries onto the generated models with a library like Mantle or manual init methods. The property types match what the parser produces.

JSON to ObjC Model FAQs

What does the output contain?
An @interface block per JSON object with @property declarations: NSString for strings, NSNumber for numbers and booleans, NSArray for arrays, and nested model types for objects.
Why NSNumber instead of int?
JSON numbers arrive as NSNumber objects from NSJSONSerialization, so the model uses NSNumber to hold them directly without conversion loss.
How are nested objects handled?
Each nested object becomes its own @interface declared above the parent, following the standard Objective-C model layer pattern.
How are arrays typed?
Arrays become NSArray with a lightweight generic like NSArray<NSString *> when the element type is uniform, which modern Objective-C supports.
Is this still relevant with Swift around?
Yes. Large existing iOS codebases remain Objective-C, and new model classes for them still need writing, which this tool speeds up.
Advertisement