简体   繁体   English

Xcode Json在数组中返回nil

[英]Xcode Json returns nil in array

I don't see what i am doing wrong here but i can't get the JSON back good in the array.. 我在这里看不到我做错了什么,但无法在数组中重新获得JSON。

this is what JSON returns: 这是JSON返回的内容:

(html) (html)

"Response": {
    "objecten": {
        "object": [
            {
                "id": "12345

(Xcode) (Xcode)

NSArray *array = [dictionary objectForKey:@"object"];
if (array == nil) {
    NSLog(@"No 'data' in array");
    return;
}

i get the error because its nil, but if i fill in @"Response" instead of @"object" i get an array back with data. 我收到错误是因为它为零,但是如果我填写@“ Response”而不是@“ object”,则会得到一个包含数据的数组。

Then i loop thrue it 然后我循环穿过它

for (NSDictionary *resultDict in array) {
    NSLog(@"%@",resultDict);

and it has only "objecten" nothing more... 而且它只是“反对”而已...

So what am i doing wrong ? 那我在做什么错?

It's just a tree of objects. 它只是一棵对象树。 Try: 尝试:

NSArray * arr =[[[dictionary objectForKey:@"Response"] objectForKey:@"objecten"] objectForKey:@"object"]]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM