I want to push data from a json to firebase without generating a new key for each object. Ideally I would like to define the name of the key.
Here is my code :
import pyrebase
import json
config = {my firebase config}
firebase = pyrebase.initialize_app(config)
db = firebase.database()
with open('myjson.json') as response:
data = json.load(response)
db.child("customer").push(data)
my json looks like this :
{
"first_customer": {
"createdat": "2019-08-09T06:40:10+0000",
"expires": 1572039000.0,
},
"second_customer": {
"createdat": "2019-08-09T06:33:39+0000",
"expires": 1570048200.0,
}
}
but actually my code give me this on firebase :
"customer": {
"-Lm_M6OM7MCV3_PFvcSH(random_id_given_by_firebase)": {
"first_customer": {
"createdat": "2019-08-09T06:40:10+0000",
"expires": 1572039000.0,
},
"second_customer": {
"createdat": "2019-08-09T06:33:39+0000",
"expires": 1570048200.0,
}
}
}
what i expect is :
"customer": {
"first_customer": {
"createdat": "2019-08-09T06:40:10+0000",
"expires": 1572039000.0,
},
"second_customer": {
"createdat": "2019-08-09T06:33:39+0000",
"expires": 1570048200.0,
}
}