-3

I'm receiving a JSON value from a rest api like this.

"['value1,'value2']"

However, how do I convert that to an NSMutableArray? the said value is received as a NSString.

user962206
  • 15,637
  • 61
  • 177
  • 270

1 Answers1

1

if your string has a json format you could try:

//content is your string
NSData *data = [content dataUsingEncoding:NSUTF8StringEncoding];
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
//access json as an array.
[json objectAtIndex:0];
Calc91
  • 124
  • 2