Paste Objective-C on the left and click "Convert" — we will turn it into JSONPaste Objective-C code

What this tool does

If you have an Objective-C NSDictionary literal, an NSArray of models, or a full class with a pile of @property declarations, and you just want the JSON representation — this tool does it. No need to write a throwaway program that calls NSJSONSerialization to see the output.

The output matches what [NSJSONSerialization dataWithJSONObject:options:error:] would give you on the equivalent in-memory object graph. NSDictionary becomes a JSON object, NSArray becomes a JSON array, NSString stays a string, NSNumber becomes a number or boolean depending on the underlying type (@YES/@NO vs @42), NSNull / [NSNull null] becomes null. NSDate is emitted as an ISO-8601 string — the convention most iOS apps settle on.

If you paste a full class (@interface Order : NSObject ... @end plus an @implementation or a literal [[Order alloc] init] with property assignments), the converter reads each @property and builds the JSON object with those keys. Nested classes — an Address property on Order — are expanded as nested JSON objects. Multiple classes pasted together come out as multiple top-level entries.

How to use it

Three steps. Works for a single dictionary literal or a file full of classes.

1

Paste your Objective-C (or try the sample)

Drop your code into the left editor. An NSDictionary literal, an NSArray, a class with @property, or a class instance with assignments — all fine.

Leave the @ prefixes, pointer stars, and bracket syntax alone. The parser understands @{...}, @[...], and @"...".

2

Hit Convert

Click the green Convert button. The tool reads every dictionary, array, property, and value, and builds the JSON in one pass.

3

Copy the JSON

The right panel gives you indented JSON, ready for a test fixture, an API mock, or documentation. Copy and go.

When this actually comes in handy

iOS API response fixtures

Paste the dictionary you would pass to <code>dataWithJSONObject:</code> in a unit test and save the output as a .json fixture. Keeps the test deterministic.

Documenting legacy Obj-C models

An old iOS codebase has Obj-C classes you need to document in an OpenAPI spec. Convert each model to JSON to get the schema shape without guessing.

Porting to Swift

As part of Swiftification, you want the JSON shape implied by each Obj-C class. This is a quick way to generate that reference before writing the Codable struct.

Backend handoff

You have an NSDictionary ready to POST. Paste to double-check the JSON shape matches the API contract before the request goes out.

Common questions

Does it match NSJSONSerialization output?

Yes — that is the target. NSDictionary/NSArray/NSString/NSNumber/NSNull map the standard way. NSDate is stringified as ISO-8601 (NSJSONSerialization itself does not handle NSDate — the tool picks the widely-used convention).

Can I paste a class with @property declarations?

Yes. Each @property becomes a key in the JSON object, with the type informing how the value is emitted (e.g. NSString * → string, NSNumber * → number). If the sample also includes property assignments, those values fill the JSON; otherwise placeholder values are used.

How are BOOL and NSNumber distinguished?

@YES / @NO and [NSNumber numberWithBool:] emit JSON true/false. Integer and float NSNumber literals (@42, @3.14) emit JSON numbers — same rule NSJSONSerialization applies when it can tell from the encoded type.

What about nested classes and arrays of objects?

Nested NSDictionary and NSArray expand fully. A class that has another class as a property comes out as a nested JSON object. An NSArray of model instances becomes a JSON array of objects, one per instance.

Is my code stored?

Your code is sent to the backend for conversion and is not persisted — we do not log the payload. Still, redact any real keys or tokens in the sample first.

Does it handle NSDate, NSURL, and other Foundation types?

NSDate becomes an ISO-8601 string. NSURL becomes its absolute URL string. NSData becomes base64. These are the conventions most iOS teams use when serializing, documented in Foundation.

Other tools you may need

Objective-C to JSON pairs well with the rest of the toolbox: