["api",["API","Apiales","Apiaceae","Apicomplexa lifecycle stages","Apia","Apicomplexa","Apidae","APIA Leichhardt Tigers","Apical consonant","Apical membrane"]]
我如何使用 SBJson Parser for iOS 解析这个 JSON。我需要它是一个只有这些值的数组:
"API","Apiales","Apiaceae","Apicomplexa lifecyclestages","Apia","Apicomplexa","Apidae","APIA Leichhardt Tigers","Apical consonant","Apical membrane"
我当前的代码:
SBJsonParser *parser = [[SBJsonParser alloc] init];
// Prepare URL request to download statuses from Twitter
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://en.wikipedia.org/w/api.php?action=opensearch&search=dj&limit=100&namespace=0&format=json"]];
// Perform request and get JSON back as a NSData object
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
// Get JSON as a NSString from NSData response
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSDictionary *results = [json_string JSONValue];
NSArray *statuses = [parser objectWithString:json_string error:nil];