Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parse json feeds using jsonkit iOS [closed]

Tags:

json

ios

ios4

I'm trying to use the JSONKIt found here https://github.com/johnezang/JSONKit to parse through a JSON Feed and put into objective-c objects. I'm new at iOS and don't really know where to start. Are there any good tutorials for using this library?

like image 408
Mike Silvis Avatar asked Dec 05 '22 21:12

Mike Silvis


1 Answers

After googling, I didn't find any tutorials but using JSONKit should be self explanatory.

After downloading your JSON feed using NSURLConnection or ASIHTTPRequest simply create a dictionary of all the objects in the JSON feed like so:

//jsonString is your downloaded string JSON Feed
NSDictionary *deserializedData = [jsonString objectFromJSONString];

//Helpful snippet to log all the deserialized objects and their keys
NSLog(@"%@", [deserializedData description]);

After creating a dictionary you can simply do something like this:

    NSString *string = [deserializedData objectForKey:@"someJSONKey"];

And that is the basics behind JSONKit.

JSONKit is much more powerful of course, you can find some of the other things you can do with it in JSONKit.h

like image 121
bobbypage Avatar answered Dec 25 '22 09:12

bobbypage