0

我有这个 json 链接 Json_link

我如何获得 (17 : 00) 和 (Amberg) 和 (Aubstadt) 值。并提前感谢。

4

1 回答 1

0

将 JSON 库添加到您的项目中并将代码放在解析文件中

NSArray* latestLoans = [(NSDictionary*)[responseString JSONValue] objectForKey:@"commands"];
[responseString release];

NSLog(@"%@",[[latestLoans objectAtIndex:0] objectForKey:@"name"]);
NSLog(@"%@",[[[latestLoans objectAtIndex:0] objectForKey:@"parameters"] objectForKey:@"container"]);
NSLog(@"%@",[[[latestLoans objectAtIndex:0] objectForKey:@"parameters"] objectForKey:@"content"]);
NSLog(@"%@",[[[latestLoans objectAtIndex:0] objectForKey:@"parameters"] objectForKey:@"position"]);



NSLog(@"%@",[[latestLoans objectAtIndex:1] objectForKey:@"name"]);
NSLog(@"%@",[[[[latestLoans objectAtIndex:1] objectForKey:@"parameters"] objectForKey:@"params"] objectForKey:@"date"]);
NSLog(@"%@",[[[[latestLoans objectAtIndex:1] objectForKey:@"parameters"] objectForKey:@"params"] objectForKey:@"display"]);
NSLog(@"%@",[[[[latestLoans objectAtIndex:1] objectForKey:@"parameters"] objectForKey:@"params"] objectForKey:@"timestamp"]);
于 2012-07-30T13:31:21.493 回答