我有一个json如下。您可以看到same here的树状图。Manipual json与Js
{
"results": {
"collection1": [
{
"property1": {
"href": "http://www.somesite.com/neatobambino/2015/12/29/Little-Girl-Uses-Dogs-Tail-as-a-Paintbrush/",
"text": "Little Girl Uses Dog's Tail as a Paintbrush"
},
"property5": {
"alt": "",
"src": "",
"text": ""
},
"index": 1,
"url": "http://www.somesite.com/"
},
{
"property1": {
"href": "http://www.somesite.com/2015/09/11/20-Alternative-Housing-Solutions-for-the-Homeless/",
"text": "20 Alternative Housing Solutions for the Homeless"
},
"property5": [
{
"alt": "",
"src": "http://www.somesite.com/page/data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",
"text": ""
},
{
"alt": "",
"src": "http://www.somesite.com/page/data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",
"text": ""
}
],
"index": 2500,
"url": "http://www.somesite.com/page/84"
}
]
}
}
正如你所看到的结果是两个层面里面。在results
里面,我们再次有collection1
。整个json在一个对象data
内。如何将collection1
中的整个数据直接移动到results
?
有些事情。
var data.results = data.results.collections;
你可以这样做吗?
我会试试看。谢谢.. – esafwan