Parsing JsonArray using SBJson Framework in Xcode 5

721 views Asked by At

I am getting json data from url as below:

{"message":"success","vendors":[{"businessname":"webixion","vendorid":"67","vendor_city":"kakinda"}]}

How to retrieve all 'message',businessname','vendorid','vendor_id' values

I am using SBJson Framework in Xcode 5 of IOS 7.

Please help me to solve this problem

1

There are 1 answers

2
Bob Vork On

I'm not sure if you have a reason to use SBJSON over the native NSJSONSerialization, but the latter is about 5 times faster in my completely unscientific tests.

With NSJSONSerialization, you would do something like this:

    NSURL *url = [NSURL URLWithString:@"http://url/to/file.json"];
NSData *data = [NSData dataWithContentsOfURL:url];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];