dixnary //json file

{

“widget”:
{
“window”:
{

“title”: “Sample Konfabulator Widget”, “name”: “main_window”,
”width”: 500,

“height”: 500
},

“image”:
{
”src”: “Images/Sun.png”, “name”: “sun1”, “hOffset”: 250, “vOffset”: 250, “alignment”: “center”

}
}

}
dic=[NSJSONSerialization JSONObjectWithData:dta options:NSJSONReadingMutableContainers error:&error];

dic1=[dic valueForKeyPath:@”widget”];
arr1=(NSMutableArray *)[dic1 allKeys];
or
arr1=[dic1 allKeys];

arr2=[dic allValues];

dic3=[dic valueForKeyPath:@”widget.window”]; or
dic3=[dic valueForKeyPath:@”widget.image”];

in tableview cell print

cell.textLabel.text=(NSString *)[arr1 objectAtIndex:indexPath.row];

cell.detailTextLabel.text=[NSString stringWithFormat:@”%@”,[arr2 objectAtIndex:indexPath.row]];

Leave a comment