-1

Possible Duplicate:
iPhone/iOS JSON parsing tutorial

I'm trying to parse the following JSON information in my IOS 5 app;

[
    {
    "name":"Aranmore",
    "pressures":[
        "1019.000"
    ],
    "temps":[
        "8.600"
    ],
    "waterLevels":[
        "0.726"
    ],
    "dates":[
        "01/12/2012 21:00:00"
    ]
},
{
    "name":......
}

I can get the names to populate the table view from the array, when the user selects the cell I want the additional information associated with the name to populate labels in another view.

Any suggestions?

Community
  • 1
  • 1
gfitz26
  • 17
  • 1

2 Answers2

1

If you parse your jSON to NSArray, when the user tap a cell you can use (in didselect... method)

objClass *obj = [yourArray objectAtIndex:indexpath.row];

And the you have the object with the info.

Vertig0
  • 623
  • 3
  • 15
1

I think the best way is to subclass of UITableViewCell and create new property with type of NSArray or NSMutableArray. In this property put this object from JSON array. Then if you want to use this data in the future, you can simply get this data from selected cell. You select cell and read data from e.g. cell.data. simple.

Tomasz Szulc
  • 4,217
  • 4
  • 43
  • 79