0

就是这样的内容...

[
    {
        "id": "",
        "title": "",
        "website": "",
        "categories": [
            {
                "id": "",
                "label": ""
            }
        ],
        "updated": 
    },
    {
        "id": "",
        "title": "",
        "website": "",
        "categories": [
            {
                "id": "",
                "label": ""
            }
        ],
        "updated": 
    }
]

如何将每个提要源插入一个数组?

 NSDictionary *results = [string JSONValue];
NSArray *subs = [results valueForKey:@"KEY"];

我必须插入哪个键?谢谢

4

1 回答 1

2

我可以看到你的结构,你会摆脱这个 JSON-String

NSArray:
[
    NSDictionary:
    {
        NSString: "id",
        NSString: "title",
        NSString: "website",
        NSArray:  "categories": 
        [
            NSDictionary:
            {
                NSString: "id",
                NSString: "label"
            }
        ],
        NSNumber: "updated"
    },
    NSDictionary:
    {
        ...
    }
]

所以你已经在根目录有一个“Feeds”数组,你必须用它们在数组中的索引来迭代它们。对于第一个 id 即[[myJsonStructure objectAtIndex:0] objectForKey:@"id"];

于 2013-06-30T22:02:27.777 回答