我有一个应用程序,我从web服务得到这样的响应。任何人都可以告诉我如何解析它以使其成为单独的字符串"Info":
{
"name":"gdgdgdgd",
"desc":"Cosmopolitan life, adventurous outlook, 'been there done that' attitude, and yet the way the life ...",
"address1":" 2nd A Main ",
"address2":" Layout,"
},
答案 0 :(得分:2)
这是对象的JSON表示。
在iOS 5中,我们将JSON类添加为NSJSONSerialization
这是一个教程:
http://www.raywenderlich.com/5492/working-with-json-in-ios-5
这是另一个讨论其他选项的线程,比如JSONKit,YAJL
答案 1 :(得分:-1)
使用json库
这样做NSMutableDictionary * listd = [dict objectForKey:@“merchantInfo”];
if([listd isKindOfClass:[NSDictionary class]])
{
stringshopname=[listd objectForKey:@"name"];
stringshopdesc=[listd objectForKey:@"desc"];
}