I need to parse the following nested json.
{
"status":1,
"value":{
"details":[
{
"text":"this is test",
"company":"General Marketing Company",
"date":"05-DEC-15"
},
{
"text":"this is test2",
"company":"NJ, Chennai",
"date":"05-DEC-15"
},
{
"text":"Sample test message for welcome",
"company":"sd",
"date":"22-JAN-16"
}
]
}
}
Following is my code,
NSString* testimonialResponse = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSData *jsonData = [testimonialResponse dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:nil];
NSLog(@"Response %@",jsonDic[@"value"][@"details"]);
The above code can actually be able to parse the contents within details in general but it cant be able to parse each of those datas uniquely.say for instance, my code doesn't list all company names,texts,dates uniquely.