i’m trying to parse the response i get from a http get request in object c, i have do this:
NSString *returnValue = [[NSString alloc] initWithData:oRespondeData encoding:NSUTF8StringEncoding];
SBJsonParser *jParser = [[SBJsonParser alloc] init];
NSDictionary *JSONresponse = [jParser objectWithString:returnValue];
then i search for a specific key:
NSArray *jSon1 = [JSONresponse objectForKey:@"links"];
and in the array there is only one element, and if i log it i have this:
NSLog(@"%@",[jSon1 objectAtIndex:0]);
log:
(
"Video.720p.X264-..",
"",
"http://video/dl/Video.720p.X264-.."
)
how i can get the url with http? i have tried everything, i have also tried to trim the string to delete the whitespaces, but seems that it’s not a nsstring because i receive
[__NSArrayM stringByTrimmingCharactersInSet:]: unrecognized selector sent to instance
how i can do?
[jSon1 objectAtIndex:0]is returning an array of 3 separate strings, so if yo’ure trying to get the 3rd string you could do:
NSArray *links = [jSon1 objectAtIndex:0];NSString *httpUrl = [links objectAtindex:2];Hopefully i understand your question correctly.