Hello.

JSON gives a string of type {"id":5,"name":"\u041b\u044e\u0431\u0438\u043c\u043e\u0439"} , then I parse it into arrayOfNames :

 arrayOfNames = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; 

and when I display in cell.textLabel.text, an error occurs:

[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x9323ce0 2013-02-21 17:24:57.039 Floral[2326:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x9323ce0'

How to convert the string " \u041b\u044e\u0431\u0438\u043c\u043e\u0439 " to normal?

    2 answers 2

    Where do you see the array? You have a dictionary, here it is in the dictionary and converted.

      NSJSONSerialization parsit dictionary. values ​​are taken by key value:

       [arrayOfNames valueForKey:@"name"]; 
      • I do NSLog (@ "% @", arrayOfNames); displays: 10 = {id = 5; name = "\ U041b \ U044e \ U0431 \ U0438 \ U043c \ U043e \ U0439"; }; I do NSLog (@ "% @", [arrayOfNames valueForKey: @ "name"]); displays (null) - fidelcastro
      • How is arrayOfNames described? - afiki
      • NSArray * arrayOfNames; // - fidelcastro