Reputation: 4755
This is json that's being returned:
{
hashtags = (
);
symbols = (
);
urls = (
{
"display_url" = "oust.com";
"expanded_url" = "http://oust.com";
indices = (
11,
33
);
url = "http://t.co/NY8wYCI9Bc";
}
);
"user_mentions" = (
);
}
I tried the following: [JSON valueForKey:@"urls[0]/url"];
but I keep getting (null)
. Any suggestions? Thank you all!
Upvotes: 0
Views: 84
Reputation: 102
You can retrieve the url parameter from the json string returned by Twitter as follows:
NSString *url = [JSON[@"entities"][@"url"][@"urls"] valueForKey:@"url"];
Upvotes: 0
Reputation: 119242
That's not how valueForKey works. You're confusing it with literal accessors.
In your case, you'd need:
json[@"urls"][0][@"url"]
Assuming json
is the root dictionary of your JSON response.
Upvotes: 1