在谷歌上搜索了几天后,我终于强迫自己在这里问这个问题。
我的json
文件很少。
localhost/feed01.json
localhost/feed02.json
localhost/feed03.json
所有json
与此类似的文件结构。但随机数据包括随机、id、日期类型等...
[
{
"id":1,
"date": "12/12/2011",
"type": "Run",
"distance": "3 miles",
"comments": "This was really hard",
"minutes": 36
},
{
"id":2,
"date": "12/11/2011",
"type": "Bike",
"distance": "6 miles",
"comments": "All down hill...felt like nothing",
"minutes": 30
},
{
"id":3,
"date": "12/10/2011",
"type": "Walk",
"distance": "2.5 miles",
"comments": "Shouldn't have taken the dog",
"minutes": 45
}
]
现在我想将所有这些 json 文件合并到一个文件中,并默认按日期排序(在初始化时)。backbone.js
使用集合进行合并和排序的最佳方法是什么?