1

How do I get data for the link: https://itunes.apple.com/us/rss/topalbums/limit=10/json using ios6.1 xcode 4.6.
Most of the codes are for ios5 and few use jsonKit. But does ios has any inbuilt json parsing now?

I am looking forward for using only for ios6.1 and not older versions.

Cœur
  • 37,241
  • 25
  • 195
  • 267
James Patrick
  • 273
  • 4
  • 19

1 Answers1

1
NSError *requestError = NULL;
NSDictionary *myDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&requestError];
if (requestError){
    //An error occurred.
}

The return type of +JSONObjectWithData is id. It could return an NSDictionary or an NSArray. Choose whichever fits your JSON data structure.

Where responseData is, well, the data from your response. If you have a string you want to parse, convert it to NSData: https://stackoverflow.com/a/6188605/985050

Community
  • 1
  • 1
rsmoz
  • 557
  • 1
  • 5
  • 15
  • Thank you Sir.Is there any way I can also handle error and load completion .Any tutorial/link for the above would be useful.Thanks again for your time. – James Patrick Mar 15 '13 at 23:51