8

I get this from a sample Flickr response in their api site:

jsonFlickrApi({"method":{"_content":"flickr.test.echo"}, "format":{"_content":"json"}, "api_key":{"_content":"8038f7f7d7151ccbf6df2aa10b1b35ae"}, "stat":"ok"})

I can see the dictionary in there, right after the words jsonFlickApi. But how do I get rid of that leading text and put the dictionary into my NSDictionary?

marciokoko
  • 4,988
  • 8
  • 51
  • 91

1 Answers1

18

Use the NSJSONSerialization class to parse the JSON data.

Edit: The jsonFlickrApi(...) indicates that you're using a JSONP endpoint to talk to Flickr. You don't need this; a plain JSON endpoint is fine. According to this Flickr API documentation you can fix this by including the parameter nojsoncallback with the value 1 when you make your request.

bdesham
  • 15,430
  • 13
  • 79
  • 123