When I use the SBJsonParser I don’t get an NSDictionary I can use. Here is the code I used on the JSON string returned by my request:
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSDictionary *stuff = [parser objectWithString:jsonString error:nil];
When I print out the dictionary it created I see:
{
conferences = (
(
“demo”,
“Demo Database”
),
(
“dev”,
“Development Database”
),
(
“TESTING”,
“Testing Database”
),
(
T2011,
“T 2011”
),
(
“C2010”,
“C2010”
)
);
}
and I’ve tried to access some of the data but I am unable to because it does not recognize any of the key’s I use. How would I access the data in this Dictionary? Or is this incorrect?
Thank you!
The return type is either a NSDictionary or a NSArray depending on the structure of the JSON. In your case the data is probably interpreted as an array of key value pairs which might be returned to you as a NSArray.
Edit:
(As seen in the comments below) the parsing result was returned as a NSDictionary with a NSArray for the key “conferences”. The NSArray in turn didn’t store key value pairs but other NSArrays with two elements each.