I am sorry I misunderstood your question. If I were to do this I would use JSONKit. This allows you to create NSDictionarys
and NSArrays
from JSON objects and also serialize JSON objects from them.
If you include the .h/.m in your project (This is also included automatically in RestKit under Vendor > JSONKit) you can import JSONKit.h
and the then just call:
[myArray JSONString];
This returns you an NSString of your serialized JSON Object. There are also some other, more thorough methods that you may want to take a look at.
Original, incorrect answer:
I think this is what you are looking for:
RKObjectMapping *visualsMapping = [RKObjectMapping mappingForClass:[Visuals class]];
[carMapping mapKeyPath:@"Color" toRelationship:@"color"];
[carMapping mapKeyPath:@"Damage" toRelationship:@"damage"];
...
carMapping = [RKObjectMapping mappingForClass:[Car class]];
[carMapping mapKeyPath:@"Model" toRelationship:@"model"];
[carMapping mapKeyPath:@"Visuals" toRelationship:@"visuals" withMapping:visualsMapping];
...
[carMapping setRootKeyPath:@"myObjects"];
Here you can make against custom objects that are contained inside of other custom objects and also map attributes directly without specifying a mapping to go with it.