我需要获得JSON响应数组" A" [值计数]。下面我发布了我的JSON响应。请帮我。
response : [ {
A = [ {
name : "sons";
age = [
4
];
},
{
name : "rondo";
age = [
2
];
},
];
} ]
NSArray *firstObject = @"A";
NSArray *count = [[[responsData objectAtIndex:0] objectForKey:firstObject]valueForKey:@"name"];
下面是我当前的控制台输出:
2014-09-18 16:32:36.746 Myapp[4243:60b] TEST : (
sons,
rondo
)
我需要如下所示"名称值计数"
2014-09-18 16:32:36.746 Myapp[4243:60b] TEST : (
2
)
答案 0 :(得分:0)
试试这个:
NSArray *count = [[[responsData objectAtIndex:0] objectForKey:firstObject]valueForKey:@"name"];
NSLog(@"count == %d",[count count]);