How do I retrieve a JSON parameter with into an NSArray/NSDictionary
I need help here.
This is my JSON webservice http://webservice.creaworld.sg/vesselservice.ashx?test.
Select the method getdatasetmem_serialize notice that the JSON data has a backslash or escape char in it.
Why is this happening?, and how do I retrieve the value in, lets sa开发者_C百科y, the i_member_id
in Xcode? I know that the retrieved JSON data "Table" is an Array and it has 2 dictionaries in it.
Why do you need to parse serialized response? Can you parse normal JSON?
NSError *error;
NSDictionary *json = [parser objectWithString:content error:&error];
if ( json == nil ) {
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:@"Error"
message:[error localizedDescription]
delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[errorAlert show];
[errorAlert autorelease];
} else {
NSArray *trends = [json objectForKey:@"trends"];
for (NSDictionary *trend in trends) {
[viewController.names addObject:[trend objectForKey:@"name"]];
[viewController.urls addObject:[trend objectForKey:@"url"]];
}
}
精彩评论