2015-02-05 51 views
1

將JSON文件導入到Firebase中後,它將從0(最高位爲零)開始,而不是locations將JSON文件導入Firebase時,如何設置初始密鑰對?

What ends up in Firebase

這是JSON文件,我導入

[{"locations": 
    [{"location_id":1,"location":"2331 Fair","location_type_id":1}, 
    {"location_id":2,"location":"6800 Norm","location_type_id":1}] 
}] 

如何才能擺脫頂部0所以我參考與[name-of-firebase-database]/locations代替[name-of-firebase-database]/0/locations開始?

回答

3

從改變你的JSON結構:

[{"locations": 
    [{"location_id":1,"location":"2331 Fair","location_type_id":1}, 
    {"location_id":2,"location":"6800 Norm","location_type_id":1}] 
}] 

{"locations": 
    [{"location_id":1,"location":"2331 Fair","location_type_id":1}, 
    {"location_id":2,"location":"6800 Norm","location_type_id":1}] 
} 

0是存在的,因爲你的頂層結構是一個列表。