Objective-C to XML Converter
Paste Objective-C interfaces or objects. Get clean XML back.
Input
Output
Paste your Objective-C code on the left and press Convert.
Or drop a file on this box, , or .
What this tool does
Somewhere there is still an Objective-C app talking to a SOAP service, reading a hand-made XML config, or loading a fixture in an XCTest target, and someone has to write that XML so it matches the @interface. Counting @property lines and stripping nonatomic, copy in your head gets old quickly. Paste the header (plus the code that fills an instance in, if you have it) and the page sends it to our converter, which hands back an XML document starting with the <?xml version="1.0"?> declaration and a single root element named after your class.
The Cocoa types are mapped one by one rather than by text substitution. An NSString turns into escaped element text. NSNumber and NSDecimalNumber lose their boxing, so [NSDecimalNumber decimalNumberWithString:@"249.99"] is written as 249.99, and @YES / @NO come out as lowercase true / false. nil and [NSNull null] leave an empty element behind instead of a gap. An NSArray<OrderItem *> *items property gets an <items> wrapper holding an <OrderItem> for each object, which is close to the tree you would assemble by hand with NSXMLElement.
Instance variable backing is handled too. If your @property uses @synthesize customerName = _customerName;, the element is still named customerName, not _customerName: that iVar naming is an implementation detail, not part of the wire format. Nested objects (an Order with an Address @property) get expanded in place, and nil values become empty elements so the shape stays consistent. If you paste several @interface blocks, every one lands in the output. Paste it the way it sits in your .h file, no cleanup needed, and check the result against what NSXMLDocument would produce.
How to use it
There are two buttons on this page, Load Sample and Convert, so the whole job fits in three short steps.
Paste your Objective-C (or try the sample)
Paste into the left editor exactly what Xcode shows you: an @interface with its properties, the @implementation stub, and the code that builds an instance. Load Sample gives you an Order with two OrderItem objects and a London Address, set up with [[Order alloc] init] and dot-syntax assignments.
#import lines, #pragma mark separators and attributes such as (nonatomic, strong) can stay where they are. Only the properties and the values you assign end up in the XML; method bodies are skipped.
Hit Convert
Press the green Convert button. Your Objective-C goes off to our backend, which reads the class declarations and any assignments and returns the XML. The panes are covered by a "Converting..." overlay until the answer arrives, usually after a few seconds.
Copy the XML
Your XML lands in the right pane, two-space indented, with real values where your code assigned them and empty or zero defaults where it only declared a property. Select it and copy it into a plist, a request body or a fixture, and if you want proof it parses, feed it to NSXMLParser or the XML Validator.
When this actually comes in handy
Building iOS plist fixtures
You have an Objective-C model and need a matching Info.plist or data-seed plist. Paste the class, get the XML, drop it into your bundle, no hand-writing <dict> / <key> pairs.
Cocoa XML config files
Old desktop Cocoa apps still ship XML config. Turn your Settings class into a ready-to-edit template so your config matches the code that reads it.
Legacy SOAP / WCF clients on iOS
If your iOS app still talks to a SOAP endpoint, you can paste the request contract class and get the XML envelope body: easier than hand-building NSXMLElement trees.
Seeding Mac OS XML workflows
Old AppleScript / Automator / XML-RPC integrations expect XML. Paste the Objective-C model, get the XML, feed it into the workflow, no manual translation.
Common questions
Can I paste multiple @interface declarations at once?
Yes. Paste a whole header file. Each @interface comes through with nested types expanded. If your @interface declares ivars explicitly (inside { }) or uses modern @property-only style, both work the same.
How are @property attributes handled?
Attributes like (nonatomic, copy), (strong), (weak), (readonly), and (assign) are metadata for the runtime: they do not change the serialized shape. The element name is the property name. readonly properties are still emitted (they still hold a value). Computed properties from custom getters are treated like any other property.
What about iVar naming: do I get _underscore elements?
No. If your property is customerName and the backing iVar is _customerName, the XML element is <customerName>. The underscore is an Objective-C convention, not a wire format. If you want to rename an element, rename the @property itself and re-paste.
How are NSString, NSNumber, NSDecimalNumber, BOOL, and NSDate treated?
NSString becomes a text node with proper XML escaping. NSNumber and NSDecimalNumber lose their wrapper and become plain numeric text. BOOL becomes true / false (or YES / NO if the source code uses the plist convention). NSDate comes out as an ISO-8601 string. nil values become empty elements rather than being dropped.
What about NSArray, NSDictionary, and nested objects?
An NSArray becomes a wrapper named after the property, and each object inside it gets its own element named after its class (or <Item> for plain strings and numbers), so the sample yields <items><OrderItem>...</OrderItem></items>. An NSDictionary works differently: each key turns into a child element of its own, with characters that XML forbids in names replaced. A property typed as another @interface, like Address *shippingAddress, is written out in full inside its parent.
Is my code stored?
Not by this page. Clicking Convert posts the Objective-C to our conversion backend, the XML comes back in the response, and the site does not save it anywhere. The request does leave your machine, though, so swap out real API keys, tokens or customer data in string literals before you paste.
Other tools you may need
If the same Objective-C model also has to travel as JSON, or you want to poke at the XML you just generated, start with these: