During storing an object to my firebase, I am expecting the structure as image below, but what I get was a generated running number as a key. This is my code to store an object to firebase
var location = []; location.push({ ms_jhr_1 : { name: value }, ... }); const a = firebase.database().ref('Food/'+id); a.set(location); How do I keep my structure without generate the running number?

location = {}and useObject.assign(location, newData). If you have to have an array, then you are going to need to useArray.reduceto create a map to send to firebase.