JSON to Objective-C Class
Turn a JSON sample into a Objective-C class in your browser. Absent and null fields stay distinct, and nothing is uploaded.
What the JSON to Objective-C generator does
Each object becomes an @interface with one property per key, and the other classes are forward-declared with @class so the file compiles as one unit. Object-typed properties are declared strong and string-typed ones copy, which is the ownership convention every Objective-C codebase expects. Objective-C object pointers are already nilable, so a field that was null or absent needs no marker; the type is a pointer either way.
How to use it
JSON to Objective-C Class: paste the JSON into the box above, set Root type name (default "Root"), and press Run to get the Objective-C class below.
Worked example
Input:
{
"orderId": "A-1001",
"total": 129.99,
"currency": "EUR",
"paid": false,
"customer": {
"email": "ada@example.com"
},
"lines": [
{
"sku": "X1",
"qty": 2
},
{
"sku": "X2",
"qty": 1,
"discount": 0
}
]
}
Output:
// Generated from a JSON sample in the browser by AllTools — nothing was uploaded.
// Rename and adjust to taste; the shape is inferred from one example, not a schema.
#import <Foundation/Foundation.h>
@class Customer;
@class Line;
@interface Root : NSObject
@property (nonatomic, copy) NSString * orderId;
@property (nonatomic, strong) NSNumber * total;
@property (nonatomic, copy) NSString * currency;
@property (nonatomic, strong) NSNumber * paid;
@property (nonatomic, strong) Customer * customer;
@property (nonatomic, strong) NSArray<Line *> * lines;
@end
@interface Customer : NSObject
@property (nonatomic, copy) NSString * email;
@end
@interface Line : NSObject
@property (nonatomic, copy) NSString * sku;
@property (nonatomic, strong) NSNumber * qty;
@property (nonatomic, strong) NSNumber * discount;
@end
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON and returns Objective-C class; reloading the page discards both.
Each object becomes an @interface with one property per key, and the other classes are forward-declared with @class so the file compiles as one unit. Object-typed properties are declared strong and string-typed ones copy, which is the ownership convention every Objective-C codebase expects. Objective-C object pointers are already nilable, so a field that was null or absent needs no marker; the type is a pointer either way.
Turn a JSON sample into a Objective-C class in your browser. Absent and null fields stay distinct, and nothing is uploaded.
How to use it
JSON to Objective-C Class: paste the JSON into the box above, set Root type name (default "Root"), and press Run to get the Objective-C class below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON and returns Objective-C class; reloading the page discards both.
What to Expect
Best for
- Converting JSON to Objective-C class when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
{ "orderId": "A-1001", "total": 129.99, "currency": "EUR", "paid": false, "customer": { "email": "ada@example.com" }, "lines": [ { "sku": "X1", "qty": 2 }, { "sku": "X2", "qty": 1, "discount": 0 } ] }
Sample output
// Generated from a JSON sample in the browser by AllTools — nothing was uploaded. // Rename and adjust to taste; the shape is inferred from one example, not a schema. #import <Foundation/Foundation.h> @class Customer; @class Line; @interface Root : NSObject @property (nonatomic, copy) NSString * orderId; @property (nonatomic, strong) NSNumber * total; @property (nonatomic, copy) NSString * currency; @property (nonatomic, strong) NSNumber * paid; @property (nonatomic, strong) Customer * customer; @property (nonatomic, strong) NSArray<Line *> * lines; @end @interface Customer : NSObject @property (nonatomic, copy) NSString * email; @end @interface Line : NSObject @property (nonatomic, copy) NSString * sku; @property (nonatomic, strong) NSNumber * qty; @property (nonatomic, strong) NSNumber * discount; @end
Frequently asked questions
How do I use the json to objective-c class?
JSON to Objective-C Class: paste the JSON into the box above, set Root type name (default "Root"), and press Run to get the Objective-C class below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.