經過幾天在谷歌上搜索,我終於推動自己在這裏問問題。將幾個json文件合併爲一個
我有幾個json
文件。
localhost/feed01.json
localhost/feed02.json
localhost/feed03.json
所有的json
文件結構與此相似。但隨機數據,包括隨機,編號,日期等類型...
[
{
"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
的最佳方法是什麼?
jQuery有['$指定的規則進行排序後指定的比較.merge'](http://api.jquery.com/jQuery.merge/)。 – 2012-10-22 11:04:22
感謝評論@Tichodroma。那backbone.js呢? –