【发布时间】:2016-02-05 10:31:41
【问题描述】:
我有一本字典,形式为我想获取“id”的值
{
"procedures": [5950]
0: {
"Procedures": {
"id": "1"
"procedure_name": "3d render w/o postprocess"
"procedure_code": "76376"
}
}
1: {
"Procedures": {
"id": "2"
"procedure_name": "3d rendering w/postprocess"
"procedure_code": "76377"
}
我只想得到“id”的值 我如何得到这个值
我把下面的代码
NSString *post = @"api_key=............";
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http:........"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSDictionary *dict6 = [self cleanJsonToObject:responseData];
【问题讨论】:
-
请提供更多信息...您想要所有 id 还是特定 id?
-
是的,我只想要字典形式的 id
-
你能完整回复一下吗....
-
它包含在一个包含 5940 个元素的数组中,因此无法显示完整的响应