所以我有一个以下格式的 JSON:
{
"data": {
"last_updated": 1342277036,
"stream": [
{
"action": {
},
"to": [
],
"from": [
],
"timestamp": 1342276421
},
{
"action": {
},
"to": [
],
"from": [
],
"timestamp": 1342276421
},
{
"action": {
},
"to": [
],
"from": [
],
"timestamp": 1342276421
},
然后我提出另一个请求并得到相同的响应。我想结合这两个 JSON,基本上将我拥有的新“流”数组附加到旧的。到目前为止,这是我所做的失败的事情:
NSMutableArray *streamArray =
[NSMutableArray arrayWithArray:[[streamDiskData valueForKey:@"data"] valueForKey:@"stream"]];
NSArray *newFeeds = [[jsonData valueForKey:@"data"] valueForKey:@"stream"];
//append the old JSON array with the new feeds stream
[streamArray insertObjects:newFeeds atIndexes:indexSet];
所以streamDiskData
这里是旧的 JSON 和jsonData
新的 JSON。我做错了什么,我该怎么做?