I've been learning how to parse JSON using the JSON framework and ASIHTTPRequest for iOS. I've tested using twitter feeds and also a custom feed through a community tutorial. All is going well.
I then thought I'll test using the Microsoft Odata Service for Northwind db. You can view the json results here:
http://jsonviewer.stack.hu/#http://services.odata.org/Northwind/Northwind.svc/Products%281%29?$format=json
Now I've struggling to work out how to parse just the product name. Can anyone point me in the right direction?
On my requestFinished i have this:
- (void)requestFinished:(ASIHTTPRequest *)request
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
NSString *responseString = [request responseString];
NSDictionary *responseDict = [responseString JSONValue];
//find key in dictionary
NSArray *keys = [responseDict allKeys];
NSString *productName = [responseDict valueForKey:@"ProductName"];
NSLog(@"%@",productName);
}
In the log I have null.
If I change the valueforKey to @"d"
I get the whole of the payload but I just want the productName.
The service URL I am using is:
http://servers.odata.org/Northwind/Northwind.svc/Products(1)?$format=json