YAML to Objective-C
Paste YAML and instantly generate idiomatic Objective-C @interface/@property model declarations.
Example
Input YAML:
name: Ada
age: 36
address:
city: London
Output Objective-C:
#import <Foundation/Foundation.h>
@interface Address : NSObject
@property (nonatomic, copy) NSString *city;
@end
@interface Root : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) NSInteger age;
@property (nonatomic, strong) Address *address;
@end
How it works
It parses your YAML with js-yaml, infers a type model for each key (including nested objects and arrays), then emits Objective-C @interface blocks with strongly-typed @property declarations.
Good to know
This YAML to Objective-C converter turns a YAML document into ready-to-paste Objective-C model classes. It parses your input, walks every key, and writes @interface blocks with strongly-typed @property declarations so you can drop the result straight into a header file. It is aimed at iOS and macOS developers who receive YAML config or fixture data and want a quick scaffold for the matching NSObject subclasses instead of hand-writing each property.
Reach for it when you are wiring up a feature against a backend or config file that ships as YAML and need a starting model layer fast, or when prototyping and you just want the shape of your data expressed as classes. The tool runs entirely in your browser, so it is also a safe option when the YAML contains sensitive keys or internal field names you would rather not paste into a remote service.
Read the output top-down: nested objects are emitted as their own classes first and the top-level mapping comes last as Root. The property attributes tell you how each field was inferred. You will see:
copy on NSString * and NSArray<...> (strings, nulls, and collections),strong on nested object pointers,assign on scalar NSInteger, double, and BOOL values.
One caveat to keep in mind: types are inferred only from the sample values you paste, so a field that happens to be an integer in your example becomes NSInteger even if it could be fractional elsewhere, and arrays are typed from their first non-null element. A null or empty value falls back to NSString *, and arrays of scalars use NSNumber *. Treat the generated header as a scaffold and adjust nullability, naming, or container element types to match your real schema before shipping.
Frequently asked questions
How are YAML scalar types mapped to Objective-C?
Integers become NSInteger, decimals become double, booleans become BOOL, and strings (or null) become NSString *. Nested mappings become their own @interface and arrays become typed NSArray<...>.
What does the root type get called?
The top-level mapping is emitted as @interface Root, and each nested object is named after its key (for example an 'address' key produces an Address class).
Is my data uploaded anywhere?
No — this tool runs entirely in your browser. Your input never leaves your device and it works offline once loaded.
Is it free?
Yes, completely free with no sign-up and no limits.
People also ask
Does the generated Objective-C include the @implementation or just the header?
It generates only the @interface declarations with @property lines, plus the Foundation import. You still need to create the matching .m implementation files and any custom init or JSON/YAML parsing logic yourself.
How are YAML keys turned into Objective-C property names?
Keys are converted to camelCase identifiers, stripping non-alphanumeric characters and joining words. A key that starts with a digit is prefixed with an underscore so it stays a valid identifier.
What happens if my YAML root is a list or a single scalar instead of an object?
The tool still produces a Root class. A top-level array becomes a Root with an 'items' property, and a single scalar becomes a Root with a 'value' property of the inferred type.
How does it name nested classes and avoid collisions?
Each nested object is named after its key in PascalCase (an 'address' key produces an Address class). If two keys would generate the same class name, the tool appends a number such as Address2 to keep names unique.
Why is a YAML array of objects typed as NSArray of a class but an array of numbers typed as NSArray of NSNumber?
The element type is inferred from the first non-null item in the array. Object items produce a generic class pointer, while scalar items fall back to NSNumber * because Objective-C arrays hold objects rather than primitives.
Does this tool handle YAML anchors, aliases, or multiple documents?
It uses the standard js-yaml loader, which resolves anchors and aliases into concrete values before type inference runs. It processes a single document, so only the first document in a multi-document stream is converted.
Is YAML date or timestamp data preserved as a date type?
No. Values that are not booleans, numbers, nested objects, or arrays are treated as strings, so dates and timestamps map to NSString *. You would change these to NSDate * manually if needed.
Can I edit the YAML and see the Objective-C update without clicking Convert?
Yes. The output regenerates automatically as you type in the input box, and the Convert button is available if you want to trigger it manually.
Related tools