Hi I'm having trouble with JSON deserialization.
I am using SBJson, the data is returned from a .net webservice.
This is the returned JSON (shortened)
{
"id": "1",
"result": [
{
"questionID": 21,
"question": "What is the secret of eternal life?"
},
{
"questionID": 20,
"question": "What is the meaning of life?"
}
]
}
I have got so far using the following code
-(void) dataLoaded:(NSData*)data {
NSString* jsonString = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
NSDictionary *jsonObject = [jsonString JSONValue];
NSLog(@"data : %@", [jsonObject valueForKey:@"result"]);
}
The following line [jsonObject valueForKey:@"result"] returns the following data
(
{
question = "What is the secret of eternal life?";
questionID = 21;
},
{
question = "What is the meaning of life?";
questionID = 20;
}
)
how do i get that data into an array?
This is the first time i've used Json so i'm not totally sure what's going on.
Thanks Mick