{"data":[
"",{"id":"1","nom":"hello","message":["",{"id":1,"nom":"dad"}]},
{"id":"2","nom":"hi","message":["",{"id":"1","nom":"marie"},{"id":"2","nom":"bob"}]}
]
}
我如何使用 iOS 从中提取数据
利用NSJSONSerialization
.
NSError *jsonError = nil;
id allValues = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
options:0
error:&jsonError];
if(jsonError!=nil)
NSLog(@"Json_Err: %@",jsonError);
NSArray *result = [(NSDictionary*)allValues objectForKey:@"data"];
为您的项目集成 Json sdk 并像这样放置以下代码...
NSStrig *jsonString = @"your json string";
NSDictionary *responseDictionary = [jsonString JSONValue];