You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
how to parse a json with array at root and no root key defined #87
Activity
[-]how to parse a json with no root key[/-][+]how to parse a json with array at root and no root key defined[/+]alan-soares-dev commentedon Jul 24, 2017
Convert the response to NSArray, then iterate:
NSArray *responseArray = responseObject;
DCKeyValueObjectMapping *parser = [DCKeyValueObjectMapping mapperForClass:[Tweet class]];
for (int i = 0; i < [responseArray count]; i++) {
Tweet *tweet = (Tweet *) [parser parseDictionary:responseArray[i]];
[self.tweets addObject:tweet];
}