1
{"response":[33689822,64091979,69682048,74160161]}

-

- (void)requestCompleted:(ASIHTTPRequest *)request
{   
    NSString *responseString = [request responseString];
    NSLog(@"okRequest|| %@",responseString);

    SBJSON *parser = [[SBJSON alloc] init];

    // Prepare URL request to download statuses from Twitter

    // Get JSON as a NSString from NSData response
    NSString *json_string = [[NSString alloc] initWithString:responseString];

    // parse the JSON response into an object
    // Here we're using NSArray since we're parsing an array of JSON status objects
    NSArray *statuses = [parser objectWithString:json_string error:nil];

    // Each element in statuses is a single status
    // represented as a NSDictionary
    for (NSDictionary *status in statuses)
    {
        //all other func..
        NSLog(@"%@ ", status);///This func prints only "response"
    }
}

How I can get array of numbers in "response"? (33689822,64091979,69682048,74160161)

3 Answers 3

1

Try this:

for (NSNumber *number in [statuses objectForKey:@"response"]) {
    NSLog(@"%@", number);
}
Sign up to request clarification or add additional context in comments.

Comments

1

You can either parse the JSON data yourself, or better, use a library like TouchJSON to do it for you.

1 Comment

@Nick Weaver, looks like you're right. +1 to you for having patience enough to resist pointing to the fine manual. :)
0

Try using JSONFragmentValue directly.

NSString *response=[request responseString];
id usableResp = [response JSONFragmentValue];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.