1

我想知道是否有人可以提供帮助。我正在使用 jQuery,并且我有一些看起来像这样的 JSON。

[
    {
        "NEW": {
            "timestamp": 1376735750000,
            "title": "Lorem ipsum 2013-08-17T10:35:50+00:00",
            "date": "Sat, 17 Aug 2013 10:35:50 GMT",
            "description": "Laborum ex sit elit occaecat pariatur consectetur id amet duis magna ex pariatur.",
            "link": "http://example.com/test/1376735750"
        }
    },
    {
        "NEW": {
            "timestamp": 1376735740000,
            "title": "Lorem ipsum 2013-08-17T10:35:40+00:00",
            "date": "Sat, 17 Aug 2013 10:35:40 GMT",
            "description": "Eiusmod sunt aliqua in eu tempor.",
            "link": "http://example.com/test/1376735740"
        }
    },
    {
        "NEW": {
            "timestamp": 1376735730000,
            "title": "Lorem ipsum 2013-08-17T10:35:30+00:00",
            "date": "Sat, 17 Aug 2013 10:35:30 GMT",
            "description": "Id ex deserunt dolor minim minim tempor incididunt cillum ad officia.",
            "link": "http://example.com/test/1376735730"
        }
    }
]

我想把它从 NEW 转移到父级,就像这样。

[
    {
        "timestamp": 1376735750000,
        "title": "Lorem ipsum 2013-08-17T10:35:50+00:00",
        "date": "Sat, 17 Aug 2013 10:35:50 GMT",
        "description": "Laborum ex sit elit occaecat pariatur consectetur id amet duis magna ex pariatur.",
        "link": "http://example.com/test/1376735750"
    },
    {
        "timestamp": 1376735740000,
        "title": "Lorem ipsum 2013-08-17T10:35:40+00:00",
        "date": "Sat, 17 Aug 2013 10:35:40 GMT",
        "description": "Eiusmod sunt aliqua in eu tempor.",
        "link": "http://example.com/test/1376735740"
    },
    {
        "timestamp": 1376735730000,
        "title": "Lorem ipsum 2013-08-17T10:35:30+00:00",
        "date": "Sat, 17 Aug 2013 10:35:30 GMT",
        "description": "Id ex deserunt dolor minim minim tempor incididunt cillum ad officia.",
        "link": "http://example.com/test/1376735730"
    }
]

任何在哪里看都会非常感激。

4

1 回答 1

1
var new_array = [];
for(var i = 0; i < your_array.length; i++){
    new_array.push(your_array[i]['NEW']);
}
于 2013-08-17T10:55:30.820 回答