After my last question was solved the JSON I'm receiving from the server changed to the following and I'm stuck handling the mapping to save the data with Core Data.
Entity
Key
- alias
- key
- keyType
- keyword
- unid
- until
JSON (from Server)
{
"documents": 1026,
"configuration":
{
...
},
"data":
[
{
"alias": "",
"key": "SALUTATION",
"keyType": "S",
"keyword": "Mr",
"unid": ""
},
...
{
"alias": "Automobile",
"key": "ACCOUNT_MARKET_SEGMENT",
"keyType": "A",
"keyword": "Automobile",
"unid": ""
}
],
"documentsFound": 770,
"maxCount": -1,
"since": "20120326200001",
"until": "20120326211309"
}
Now I want to map all the data from "data" plus the key "until" for the entity "Key" but can't find the right solution. My mapping so far to get the data looks like this and works well but misses the "until"-key, of course.
RKManagedObjectMapping* keyMapping = [RKManagedObjectMapping mappingForClass:[Key class]];
keyMapping.rootKeyPath = @"data";
[keyMapping mapKeyPath:@"key" toAttribute:@"key"];
[keyMapping mapKeyPath:@"keyword" toAttribute:@"keywordEN"];
[keyMapping mapKeyPath:@"alias" toAttribute:@"alias"];
keyMapping.setDefaultValueForMissingAttributes = YES;
Thanks for your ideas!