我從Jason URl獲取了一些醫生的數據。該數據顯示了一些醫生的單一醫生位置,並顯示了一些醫生的多個位置。我如何顯示該數據。一旦軟件給我的解決方案該數據顯示如下在ios中獲取Json數據
"id":"135","speciality":"Allergy","type":"P",
"doc_name":"Patrick M. Ambrosio, D.O., F.A.C.A.A.I.",
"doc_profile_url":"Patrick-M-Ambrosio", "doc_offices":[
{
"office_id":17,
"office_name":"Old Bridge",
"office_url":"Old-Bridge",
"state":"New Jersey",
"state_short":"NJ",
"city":"Old-Bridge",
"lat":"40.3975",
"lon":"-74.3298",
"office_combined_name":"Old Bridge,New Jersey,NJ"
},
{
"office_id":7,
"office_name":"Woodbridge",
"office_url":"Woodbridge",
"state":"New Jersey",
"state_short":"NJ",
"city":"Iselin",
"lat":"40.555",
"lon":"-74.3151",
"office_combined_name":"Woodbridge,New Jersey,NJ"
} ]
}, {
"id":"2", "speciality":"Allergy", "type":"P", "doc_name":"Ricardo Arayata, M.D., F.A.C.A.A.I.",
"doc_profile_url":"ricardo-arayata-md", "doc_offices":[
{
"office_id":22,
"office_name":"Purchase",
"office_url":"Purchase",
"state":"New York",
"state_short":"NY",
"city":"Purchase",
"lat":"41.0099",
"lon":"-73.6959",
"office_combined_name":"Purchase,New York,NY"
},
{
"office_id":15,
"office_name":"New Rochelle",
"office_url":"New-Rochelle",
"state":"New York",
"state_short":"NY",
"city":"New-Rochelle",
"lat":"40.9158",
"lon":"-73.7864",
"office_combined_name":"New Rochelle,New York,NY"
} ]
}, {
"id":"3", "speciality":"ENT", "type":"P", "doc_name":"Anna Aronzon, M.D.",
"doc_profile_url":"anna-aronzon-md", "doc_offices":[
{
"office_id":27,
"office_name":"Wall Street",
"office_url":"Wall-Street",
"state":"New York",
"state_short":"NY",
"city":"New-York",
"lat":"40.7096",
"lon":"-74.0104",
"office_combined_name":"Wall Street,New York,NY"
} ]
}, {
"id":"4", "speciality":"ENT", "type":"P", "doc_name":"Jonathan Aviv, M.D., F.A.C.S.",
"doc_profile_url":"jonathan-aviv-md", "doc_offices":[
{
"office_id":23,
"office_name":"Sleepy Hollow",
"office_url":"Sleepy-Hollow",
"state":"New York",
"state_short":"NY",
"city":"Sleepy-Hollow",
"lat":"41.0802",
"lon":"-73.8572",
"office_combined_name":"Sleepy Hollow,New York,NY"
},
{
"office_id":6,
"office_name":"East Side",
"office_url":"East-Side",
"state":"New York",
"state_short":"NY",
"city":"New-York",
"lat":"40.7768",
"lon":"-73.9541",
"office_combined_name":"East Side,New York,NY"
} ]
}, {
"id":"163", "speciality":"ENT", "type":"P", "doc_name":"Andrew Azer, M.D.",
"doc_profile_url":"andrew-azer-md", "doc_offices":[
{
"office_id":17,
"office_name":"Old Bridge",
"office_url":"Old-Bridge",
"state":"New Jersey",
"state_short":"NJ",
"city":"Old-Bridge",
"lat":"40.3975",
"lon":"-74.3298",
"office_combined_name":"Old Bridge,New Jersey,NJ"
},
{
"office_id":7,
"office_name":"Woodbridge",
"office_url":"Woodbridge",
"state":"New Jersey",
"state_short":"NJ",
"city":"Iselin",
"lat":"40.555",
"lon":"-74.3151",
"office_combined_name":"Woodbridge,New Jersey,NJ"
} ]
和我給帽子代碼也一次plaese檢查了這一點。
- offC = [[[rr objectForKey:@"doc_offices"]
objectAtIndex:0]objectForKey:@"office_name"];
NSString *docOfficeID
= [[[rr objectForKey:@"doc_offices"]objectAtIndex:0]objectForKey:@"office_id"];
什麼錯誤是U越來越??你是否將json存儲在數組中? –
是的,我已經將數據存儲在數組中。但我想寫循環檢查條件 –