I have 2 cases to parse JSON
First is:
{
\"post_filter_data\": {
\"Items\": [
{
\"ItemID\": \"50cb4e46b5
Yes, you can check using class
like
if ([[dictMenu valueForKey:@"Items"] isKindOfClass:[NSArray class]])
{
// array inside
}
Get data rx in _recievedData then check the class of the object.
id object = [NSJSONSerialization
JSONObjectWithData:_recievedData
options:kNilOptions
error:&error];
if (error)
{
NSLog(@"Error in rx data:%@",[error description]);
}
if([object isKindOfClass:[NSString class]] == YES)
{
NSLog(@"String rx from server");
}
else if ([object isKindOfClass:[NSDictionary class]] == YES)
{
NSLog(@"Dictionary rx from server");
}
else if ([object isKindOfClass:[NSArray class]] == YES)
{
NSLog(@"Array rx from server");
}