I have two kinds of json formats that are getting parsed.
The data that gives no issues and when i fetch using "orderListView" key, the array gets generated fine. Array count is 2 in this case.
{
"orderListView": [
{
"status": "AC",
"totalRecords": "5",
},
{
"status": "SH",
"totalRecords": "5",
}
]
}
There's a square bracket missing in the below data and this too gets parsed into two objects where as this should have been one object similar to the above json. How do i handle this issue?
{
"orderListView": {
"status": "AC",
"totalRecords": "1",
}
}
EDIT : Tried solution
if ([[appDelegate.orderListJson objectForKey:@"orderListView"] isKindOfClass:[NSMutableArray class]]) {
orderMainArray = [appDelegate.orderListJson objectForKey:@"orderListView"];
}
else
{
NSArray *array = [NSArray arrayWithObject:[appDelegate.orderListJson objectForKey:@"orderListView"]];
orderMainArray = [array copy];
}