How can this json be fetched. It has dynamic values in it. Below is json.
{
Level1:
{
row1:
{
1: "on",
2: "on",
3: "on",
4: "on",
5: "on",
6: "on",
7: "on",
8: "on",
9: "on",
10: "on",
attr: {
total: "10",
type: "gold"
}
},
row2: {
1: "on",
2: "on",
3: "on",
4: "on",
5: "on",
6: "on",
7: "on",
8: "on",
9: "on",
10: "on",
attr: {
total: "10",
type: "gold"
}
}
},
Level3: {
row1: {
1: "on",
2: "on",
3: "on",
4: "on",
5: "on",
6: "on",
7: "on",
8: "on",
9: "on",
10: "on",
attr: {
total: "10",
type: "silver"
}
}
}
}
In this number of levels, number of rows is dynamic and inside it the seats are also dynamic , how to tackle this i am not getting it. Please guide for the above, i have already spend a day on it. Below is my code what i had tried yet.
arrLevels = [self.mGetDataDict allKeys]; // getting all levels here in array
NSLog(@"keys:%@", arrLevels);
for(int i=0; i<[arrLevels count]; i++) // trying to get rows in array
{
receiveDataDict = [self.mGetDataDict valueForKey:[arrLevels objectAtIndex:i]];
[arrRows addObject:[NSString stringWithFormat:@"%d", [receiveDataDict count]]];
NSLog(@"data:%@", receiveDataDict);
for(int j=0; j<[receiveDataDict count]; j++)
{
NSLog(@"count:%d", [receiveDataDict count]);
dictRow = [receiveDataDict valueForKey:@"attr"];
[arrTot addObject:[dictRow valueForKey:@"total"]];
[arrType addObject:[dictRow valueForKey:@"type"]];
}
}