【发布时间】:2012-07-17 11:53:15
【问题描述】:
我是 json 新手,需要您的帮助。
我收到这样的 JSON 字符串:
{"network":
{
"network_id":111,
"name":"test name",
"city":"test city",
"country":"test country",
"description":"test desc"
}
}
如何处理此字符串并拆分键/值以便在我的视图中使用它们?
- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
self.responseData = nil;
//*********** How I can parse responseString *********//
[networkIDLabel setText:@"ADD THE VALUE"];
[nameLabel setText:@"ADD THE VALUE"];
[responseString release];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
谢谢
【问题讨论】:
-
在 JSON 解析上试试这个tutorial,。
-
看看这个问题[1]:stackoverflow.com/questions/5038371/…
-
谢谢Moonkid,问题是数组,我的字符串不是数组,你能帮我吗?
-
@Vivek12 :我查看过的所有示例都已经用于数组......并且收到的不是数组:(