1
  ["api",["API","Apiales","Apiaceae","Apicomplexa lifecycle stages","Apia","Apicomplexa","Apidae","APIA Leichhardt Tigers","Apical consonant","Apical membrane"]]

この JSON を SBJson Parser for iOS で解析するにはどうすればよいですか。これらの値のみを持つ配列である必要があります:

  "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];
4

1 に答える 1

1

試す、

NSArray *results = [json_string JSONValue];

NSArray *statuses = [results objectAtIndex:1];
于 2012-10-02T10:06:43.380 に答える