-2

Possible Duplicate:
NSJSONSerialization from NSString

I have this old code, how do I accomplish using NSJSONSerialization?

Below uses SBJSON

+ (NSDictionary *) parseJSONResponse: (NSString *) response {
    NSDictionary *dictionary = [response JSONValue];
    return dictionary;
}
Community
  • 1
  • 1
William Falcon
  • 9,813
  • 14
  • 67
  • 110
  • 2
    If you **know** that you can use `NSJSONSerialization`, why don't you google its class reference? –  Jan 04 '13 at 15:33
  • Or google "NSJSONSerialization example". Or "NSJSONSerialization tutorial". Whenever you have questions about a class (a) look at the Apple docs; and failing that, (b) look for examples and/or tutorials. – Rob Jan 04 '13 at 15:47
  • I did and it wasnt clear, so i asked the question... – William Falcon Jan 04 '13 at 16:10

1 Answers1

2

You'll need the response NSData to perform the following:

NSError *error;
NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
Stavash
  • 14,244
  • 5
  • 52
  • 80