将JSON文件导入Firebase时,如何设置初始密钥对?

When importing JSON file into Firebase, how to set initial key pair?

将 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 开头?

更改您的 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 在那里是因为您的顶级结构是一个列表。