I have a following string in iOS :-
[{"status":"0","eventid":"126"}]15.511563,73.809732[{"status":"0"}]
And I am trying to fetch this :-
[{"status":"0","eventid":"126"}]
i.e. the entire portion of string before first ] closing bracket.
I tried this in which I get a substring of 31 characters, but this won't work if the contents between the brackets changes.
NSRange start = [result1 rangeOfString:@"["];
NSString *shortString =[result1 substringWithRange:NSMakeRange(start.location, 31)];
result1 = [result1 substringToIndex:shortString.length];
NSLog(@"Response- %@",result1);
What is the correct approach?