Array
DAATA (
(
{
Description = "<p>Image3</p>";
"Image_Id" = 68;
"Image_Path" = "aa6b74d47227ebd24561211a2c95199c.jpg";
"Product_Address" = "Jaipur ,Rajastha";
"Product_Booked" = N;
"Product_Id" = 1;
"Product_Info" = "The Indian Hotels Company Limited (IHCL) and its subsidiaries are collectively known as Taj Hotels Resorts and Palaces and is recognised as one of Asia's largest and finest hotel company. Incorporated by the founder of the Tata Group, Mr. Jamsetji N. Tata, the company opened its first property, The Taj Mahal Palace Hotel, Bombay in 1903. The Taj, a symbol of Indian hospitality, completed its centenary year in 2003. ";
"Product_Latitude" = "26.9260\U00b0N";
"Product_Longitute" = "75.8235\U00b0E";
"Product_Name" = demo1;
"Product_Offer_Price" = "$200";
"Product_Price" = "$345";
"Product_Type" = "five star";
},
{
Description = "<p>yo yo</p>";
"Image_Id" = 75;
"Image_Path" = "415e2e6b7a3b1850e06467ade2e10fa9.jpg";
"Product_Address" = "jaipur,rajasthan";
"Product_Booked" = N;
"Product_Id" = 2;
"Product_Info" = "five star";
"Product_Latitude" = "";
"Product_Longitute" = "";
"Product_Name" = "hotel night rider";
"Product_Offer_Price" = "$200";
"Product_Price" = "$345";
"Product_Type" = "five star";
}
)
)
2
A
回答
1
NSString *responseString = [request1 responseString];//your json response will be here
NSMutableDictinoary *dataDict = [[[responseString JSONValue] valueForKey:@"DAATA"]mutableCopy];//take response in dictinoary
for(int i = 0 ; i<[[dataDict valueForKey:@"DAATA"] count];i++)
{
if([[[[dataDict valueForKey:@"DAATA"] objectAtIndex:i] valueForKey:@"Image_Id"] isEqualToString:@"court"])//get what you want here for example get "Image_Id"
{
NSMutableDictionary *dd=[[dataDict valueForKey:@"result"] objectAtIndex:i];
[arrCourt addObject:dd];
}
and so on.........
}
+0
謝謝,我已經做了那個時間.... –
0
檢出NSJSONSerialization並用它來解析你的json字符串。
0
另一種選擇是使用SBJson庫。
- (void) connectionDidFinishLoading:(NSURLConnection *) conn
{
//Call back called when data reception completes (stored in variable data)
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *results = [jsonString JSONValue]; // This is a new category added to the NSString by SBJSON
if ([results count]>0)
{
// decoding a JSON object like so: {"result":"yes"}
[results objectForKey:@"result"] ;
if ([[results objectForKey:@"result"] isEqualToString:@"yes"])
{
[self registrationStateSetTo:YES];
NSLog(@" registered OK ");
}
else
{
[self registrationStateSetTo:NO];
NSLog(@" registration failed ");
}
}
}
相關問題
- 1. 如何從Key Json中逐個獲取值(數組中的值)?
- 2. 如何從iPhone中的JSON格式的數組中提取字符串?
- 3. PHP:從JSON數組中提取值
- 4. 從JSON數組中提取值
- 5. 從JSON數組中提取鍵/值對
- 6. 從Json格式獲取數組值Javascript
- 7. 如何提醒json數組中的值?
- 8. 如何從Javascript中的數組數組中提取值?
- 9. 如何從PHP中的數組中提取單個值?
- 10. 如何從Twitter JSON數組中提取值
- 11. 如何在mulesoft中從json中提取JSON數組
- 12. 如何提取JSON數組中的JSON數組
- 13. 從cURL中提取數組中的值
- 14. 從數組中提取值
- 15. 從數組中提取值
- 16. 提取和格式從嵌套的JSON數據的值
- 17. 如何提取數據JSON格式
- 18. 如何從JSON中提取值
- 19. 如何從JSON響應中提取值?
- 20. Rails:如何從JSON中提取值
- 21. 如何從java中的子數組中提取json數組的子集?
- 22. 如何從JSON文檔數組中提取字段數組?
- 23. Jmeter:如何從json數組中提取第一個元素
- 24. 從JSON數組中提取數據?
- 25. 從JSON數組中提取數據android
- 26. 如何從格式{key:value}的JSON對象中獲取值?
- 27. 如何從android中的Json響應數組中獲取值?
- 28. 如何獲取json數組值的格式?
- 29. 從json格式對象中獲取值
- 30. 如何從Scala中的json格式化表單中獲取數組?
第一次寫你的代碼...然後我建議你。 – 2012-12-11 09:56:13
檢查我的答案http://stackoverflow.com/questions/12580407/i-have-json-data-given-below-and-i-want-to-display-it-in-a-table/12580451#12580451 – Rajneesh071
看起來你的價值觀已經被提取出來了,否則你怎麼能發佈它們......? – holex