Ater将JSON文件导入Firebase,它从0
(最顶端的零)而不是locations
开始索引。
这是我导入的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
开头?
答案 0 :(得分:4)
从:
更改您的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
就在那里,因为您的顶级结构是一个列表。