申し訳ありませんが、あなたの質問を誤解しました。これを行う場合は、JSONKitを使用します。これにより、JSON オブジェクトを作成しNSDictionarys
たり、JSON オブジェクトから作成しNSArrays
たり、それらから JSON オブジェクトをシリアル化したりすることができます。
プロジェクトに .h/.m を含める場合 (これは Vendor > JSONKit の下の RestKit にも自動的に含まれます)、インポートJSONKit.h
してから呼び出すことができます:
[myArray JSONString];
これにより、シリアル化された JSON オブジェクトの NSString が返されます。他にも、より徹底的な方法がいくつかあります。
元の、間違った答え:
これがあなたが探しているものだと思います:
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"];
ここでは、他のカスタム オブジェクトの内部に含まれるカスタム オブジェクトに対して作成したり、マッピングを指定せずに属性を直接マッピングしたりできます。