I receive JSON code that looks like this:
{
"rent": {
"items": [
],
"total": 0
},
"upcoming": {
"items": [
],
"total": 0
},
"watchnow": {
"items": [
],
"total": 0
}
}
I want the keys, i.e. "rent", "upcoming" and "watchnow" as a property on the mapped object, so I add a NSString property called searchSection to the class I'm using and then create this mapping:
RKObjectMapping *searchResultsMapping = [RKObjectMapping mappingForClass:[TDXSearchResults class]];
[searchResultsMapping addAttributeMappingFromKeyOfRepresentationToAttribute:@"searchSection"];
Shouldn't my mappingResult.array then contain three TDXSearchResults objects, each with either "rent", "upcoming" or "watchnow" in its searchSection property? I only get one TDXSearchResults in the array and this confuses me greatly.