i given following json object. required take schedule , display values inside of table view converting them users local time zone. okay converting time, little confused how should go retrieving schedule object , displaying start , end dates inside uitableview. appreciate here. :).
{ "zip": "70130 ", "phone": "", "ticket_link": "http://www.ticketmaster.com/new-orleans-convention-center-tickets-new-orleans/venue/221251", "state": "la", "pcode": 4, "city": "new orleans", "id": 15174, "tollfreephone": "", "schedule": [ { "end_date": "2013-01-30 20:00:00 -0800", "start_date": "2013-01-30 13:00:00 -0800" }, { "end_date": "2013-01-31 20:00:00 -0800", "start_date": "2013-01-31 08:00:00 -0800" }, { "end_date": "2013-02-01 20:00:00 -0800", "start_date": "2013-02-01 08:00:00 -0800" }, { "end_date": "2013-02-02 20:00:00 -0800", "start_date": "2013-02-02 08:00:00 -0800" }, { "end_date": "2013-02-03 14:00:00 -0800", "start_date": "2013-02-03 08:00:00 -0800" } ], "address": "900 convention center blvd", "image_url": "http://lorempixel.com/900/500/nightlife/?v=-632944306", "description": "", "name": "nfl experience, driven gmc", "longitude": -90.06418, "latitude": 29.943351 },
let's big lump of json listed downloaded , stored in nsdata
variable called jsondata
.
nsdictionary *json = [nsjsonserialization jsonobjectwithdata:jsondata options:0 error:nil; // use nserror if want nsarray *scheduledates = json[@"schedule"]; (nsdictionary *dates in scheduledates) { nsstring *enddatestring = dates[@"end_date"]; nsstring *startdatestring = dates[@"start_date"]; }
this way can access schedule , dates within schedule object. decide info. also, quick dirty way of getting info. there should nil-checking/type-safety/introspection done mapping json objects.