JSON to Objective-C Converter
Objective-C model classes from a JSON sample
Input
Output
What does the JSON to Objective-C converter generate?
NSJSONSerialization hands you nested NSDictionary and NSArray objects, and most Objective-C codebases wrap those in model classes so the rest of the app can use real properties. Paste a JSON sample here and you get those classes: @class forward declarations, one @interface ... : NSObject per JSON object inside NS_ASSUME_NONNULL_BEGIN/END, and a matching @implementation with an initWithDictionary: that copies each value across.
Property attributes follow the usual rules: assign for scalars (NSInteger, double, BOOL), copy for NSString, NSArray and NSDictionary, strong for nested model objects, and nullable for anything that was null or missing in the sample. A number that can be null becomes NSNumber *, since a scalar can't hold nil. Arrays are typed with lightweight generics (NSArray<Device *> *), and arrays of objects are turned into model instances by a small helper function.
JSON null arrives from NSJSONSerialization as NSNull; the generated code treats it like a missing key, so you get nil or 0 instead of a crash. Property names are camelCase, and names that would clash with NSObject or ARC conventions, such as description, hash, id or anything starting with new or copy, get a Value suffix. There's no NSCoding or NSSecureCoding support; add it if you archive these objects. Everything runs in your browser.
How to use it
Paste JSON and the classes appear as you type.
Paste a JSON sample
Paste into the Input panel, Upload a .json or .txt file, or click Sample. Example input:
{"subscriberId":"SUB-1001","plan":"Unlimited 5G","dataUsage":45.2,"status":"active"}Set Class Name for the root class. Check odd input with the JSON Validator first.
Read the interface and implementation
The Output panel shows the interfaces first, then the implementation section. Split it into a .h and a .m at the #pragma mark line if you prefer separate files.
Copy or download
Copy the code or Download a .m file, then create the root object with [[RootObject alloc] initWithDictionary:json].
Where this saves time
Maintaining an older iOS app
A new endpoint shows up in an app that is still mostly Objective-C. Paste the response and get models that match the house style instead of passing dictionaries around.
Replacing stringly-typed dictionary access
Code full of dict[@"subscriberId"] is easy to break with a typo. Generated properties give you autocomplete and compiler checks.
Bridging to Swift
The nullability annotations and generics carry over when Swift code imports the header, so the models show up as properly optional Swift types.
Prototyping a payload
Paste a sample from the backend team and you get a quick view of how many classes and properties the client side will need.
Common Questions
Does the output include parsing code?
Yes, a simple one: each class has initWithDictionary:, which reads the NSDictionary from NSJSONSerialization, maps nested dictionaries and arrays of dictionaries into model objects, and treats NSNull as nil. It doesn't validate types, so a string where a number was expected is stored as is.
Has it been compiled?
We syntax-check the output with clang under ARC against a minimal stand-in for Foundation, not Apple's SDK. Build it in Xcode before relying on it and review fields typed id, which mean the sample was null or mixed.
Why is a property called descriptionValue?
A property named description or hash would override NSObject methods, and ARC treats getters starting with new, copy, alloc or init as returning owned objects. Those names get a Value suffix; the dictionary key used in initWithDictionary: stays the original.
How are large integers handled?
Values that fit in 64 bits become NSInteger (64-bit on all current Apple platforms), larger positive ones unsigned long long, and anything bigger is kept as NSNumber *. Nullable numbers are always NSNumber *.
Is my JSON uploaded?
No. The classes are generated by JavaScript in your browser and nothing is sent to a server. Input is capped at 256 KB.
Other JSON Tools You Might Need
Moving the same models to Swift, or need to clean up the JSON first?