Here is a json:
{
query_list: [
{
restaurant: {},
foods: [
food1: {},
food2: {}
]
},
{
restaurant: {},
foods: [
food3: {},
food4: {}
]
}
],
url: ""
}
I want use Mantle to map it to:
@property NSString *url
@property NSArray<Foods *> *list
the list
need to contains all foods. In this case, foods are food1
food2
food3
food4
.
So how to get all foods
, combine them to a new array which map to the property list
Based on your JSON formate you have to done below thing to get all food object in single list :
NSMutableArray * mutArrayFoods = [[NSMutableArray alloc] init];
for (QueryList *objQueryList in objParseData.queryList) {
[mutArrayFoods addObjectsFromArray:objQueryList.foods];
}
Hope this will help to get all foods in single array.
Now as per your request assign this above array into list
list = [mutArrayFoods mutableCopy];