0
我希望將這些數據顯示在tableview中。誰能告訴我如何在字典或數組中獲取數據並在表中顯示?該數據被示出爲下如何從此json獲取數據
我想顯示city
和custno
{
"Status": 200,
"data": [
{
"dispatch": "11111",
"locname": "Sample Company Location 1",
"add1": "226 Engleman Street",
"city": "Bardstown",
"state": "KY",
"zip": "40004",
"contacts": [
{
"id": "1",
"custno": "0000235",
"locno": "00001",
"salutation": "Mr.",
"jobtitle": "IT Manager",
"locktime": "",
"lockby": ""
},
{
"id": "11",
"custno": "0000235",
"locno": "00001",
"contact": "Greg C",
"extension": "205",
"salutation": "Mr. ",
"jobtitle": "President",
"locktime": null,
"lockby": null
},
{
"id": "12",
"custno": "0000235",
"locno": "00001",
"extension": "206",
"salutation": "Mr.",
"jobtitle": "Parts Manager",
"locktime": null,
"lockby": null
},
{
"id": "13",
"custno": "0000235",
"locno": "00001",
"extension": "202",
"salutation": "Mr.",
"jobtitle": "Service Manager",
"locktime": "",
"lockby": ""
}
],
"locationnotes": "5/20/2010 9:32:06 PM - Updated Information1111111",
"custno": "0000235",
"locno": "00001",
"calledinby": "Teresa",
"serviceagrno": "",
"dispatchnotes": "This is a test dispatch",
"pastcustomernotes": "",
"pasttechnotes": [],
"status": "Pending",
"locationimage": "/images/content/2t_1318687848_100x100.gif",
"pmstatus": "Yes"
},
{
"dispatch": "4",
"locname": "Sample Company Location 1",
"add1": "226 Engleman Street",
"city": "Bardstown",
"state": "KY",
"zip": "40004",
"contacts": [
{
"id": "1",
"custno": "0000235",
"locno": "00001",
"extension": "200",
"salutation": "Mr.",
"jobtitle": "IT Manager",
"locktime": "",
"lockby": ""
},
{
"id": "11",
"custno": "0000235",
"locno": "00001",
"phonefax": "555-555-1002",
"extension": "205",
"salutation": "Mr. ",
"jobtitle": "President",
"locktime": null,
"lockby": null
},
{
"id": "12",
"custno": "0000235",
"locno": "00001",
"extension": "206",
"salutation": "Mr.",
"jobtitle": "Parts Manager",
"locktime": null,
"lockby": null
},
{
"id": "13",
"custno": "0000235",
"locno": "00001",
"extension": "202",
"salutation": "Mr.",
"jobtitle": "Service Manager",
"locktime": "",
"lockby": ""
}
],
"locationnotes": "5/20/2010 9:32:06 PM - Updated Information1111111",
"custno": "0000235",
"locno": "00001",
"calledinby": "Teresa",
"serviceagrno": null,
"dispatchnotes": "11/3/2011 7:59 - This is a sample ATM call.",
"pastcustomernotes": "",
"pasttechnotes": [],
"status": "Pending",
"locationimage": "/images/content/2t_1318687848_100x100.gif",
"pmstatus": "No"
},
{
"dispatch": "5",
"locname": "Sample Company Location 1",
"add1": "226 Engleman Street",
"city": "Bardstown",
"state": "KY",
"zip": "40004",
"contacts": [
{
"id": "1",
"custno": "0000235",
"locno": "00001",
"contact": "Michael B",
"email": "[email protected]",
"phoneoffice": "502-555-1000",
"phonemobile": "502-555-0769",
"phonefax": "555-555-1002",
"extension": "200",
"salutation": "Mr.",
"jobtitle": "IT Manager",
"locktime": "",
"lockby": ""
},
{
"id": "11",
"custno": "0000235",
"locno": "00001",
"extension": "205",
"salutation": "Mr. ",
"jobtitle": "President",
"locktime": null,
"lockby": null
},
{
"id": "12",
"custno": "0000235",
"locno": "00001",
"extension": "206",
"salutation": "Mr.",
"jobtitle": "Parts Manager",
"locktime": null,
"lockby": null
},
{
"id": "13",
"custno": "0000235",
"locno": "00001",
"extension": "202",
"salutation": "Mr.",
"jobtitle": "Service Manager",
"locktime": "",
"lockby": ""
}
],
"locationnotes": "5/20/2010 9:32:06 PM - Updated Information1111111",
"custno": "0000235",
"locno": "00001",
"calledinby": "",
"serviceagrno": null,
"dispatchnotes": "",
"pastcustomernotes": "",
"pasttechnotes": [],
"status": "Pending",
"locationimage": "/images/content/2t_1318687848_100x100.gif",
"pmstatus": "Yes"
}
]
}
感謝........ ,,,,, – 2011-12-18 11:50:49
當使用NSJSONSerialization,一個應可能使用「選項:kNilOptions」而不是「選項:0」。兩者都可以工作,但前者看起來更具可讀性(並且是Apple推薦的)。 – 2012-04-05 21:01:18