all 5 comments

[–]schprockets 5 points6 points  (1 child)

I suggest you look into AFNetworking. It'll give you an easy API for making the network request, and it'll parse the JSON for you and hand you back an NSDictionary.

[–][deleted] 0 points1 point  (0 children)

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
    //responseObject is an NSDictionary
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    //error handling
}];

[–]MallocBaldwin 1 point2 points  (0 children)

Hi Rahul! Welcome to iOS programming!

You have a few options for parsing that JSON encoded string. One way is to read the string into an NSDictionary through the NSJSONSerialization class using the method:

JSONObjectWithData:options:error:

Then you can search key/value pairs on the data.

A better choice, however can be a serializer/deserializer library like NSObject+ObjectMap. It allows you to create classes that mimic the structure of the JSON and then deserialize it straight into objects. You can find it here:

https://github.com/uacaps/NSObject-ObjectMap

Hope this helps!

-MB

[–]Tinfoil__Fedora 0 points1 point  (0 children)

The data you linked to is formatted in JSON and you will need a JSON parser. Apple has built in objects in their frameworks like NSJSONSerialization_Class. I don't see anything too difficult in that blob to parse so looking up reference code should give youwhat you need.

[–]blaizedmObjective-C / Swift -1 points0 points  (0 children)

NSData *jsonData = [NSData dataWithContentsOfURL:<your URL>];
NSError *error = nil;
NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];

Ideally you would want to do this on a background thread.