I have a huge database consisting of multiple tables and each table consists of thousands of records. I had exported the database from my xampp
local server in JSON format:
[
{"type":"header","version":"5.1.1","comment":"Export to JSON plugin for PHPMyAdmin"},
{"type":"database","name":"izqlinmg_electric"},
{"type":"table","name":"book_master","database":"izqlinmg_electric","data":
[
{"books":"00001"},
{"books":"00002"},
{"books":"00003"},
{"books":"00004"},
{"books":"00005"},
{"books":"00006"},
{"books":"00007"},
{"books":"00008"},
{"books":"00009"},
{"books":"00010"},
{"books":"00011"},
{"books":"00012"},
{"books":"00013"},
{"books":"00014"},
{"books":"00016"},
{"books":"00018"},
{"books":"00019"},
{"books":"00021"},
{"books":"00023"},
{"books":"00024"},
{"books":"00025"},
{"books":"00026"},
{"books":"00027"},
{"books":"00028"},
{"books":"00029"},
{"books":"00032"},
{"books":"00033"},
{"books":"00034"},
{"books":"00035"},
{"books":"00036"},
{"books":"00037"},
{"books":"00038"},
{"books":"00042"},
{"books":"00043"},
{"books":"00044"},
{"books":"00045"},
{"books":"00046"},
{"books":"00047"},
{"books":"00048"},
{"books":"00049"},
{"books":"00050"},
{"books":"00051"},
{"books":"00052"},
{"books":"00053"},
{"books":"00054"},
{"books":"00055"},
{"books":"00056"},
{"books":"00057"},
{"books":"00058"},
{"books":"00059"},
{"books":"00060"},
{"books":"00061"},
{"books":"00062"},
{"books":"00063"},
{"books":"00064"},
{"books":"00065"},
{"books":"00066"},
{"books":"00068"},
{"books":"00069"},
{"books":"00070"},
{"books":"00071"},
{"books":"00072"},
{"books":"00073"},
{"books":"10001"},
{"books":"10002"},
{"books":"10003"},
{"books":"10004"},
{"books":"10005"},
{"books":"10006"},
{"books":"10007"},
{"books":"20001"},
{"books":"20002"},
{"books":"20003"},
{"books":"20004"},
{"books":"20005"},
{"books":"20006"},
{"books":"20007"},
{"books":"20008"},
{"books":"20009"},
{"books":"20010"},
{"books":"20011"},
{"books":"20012"}
]
}
,{"type":"table","name":"colony_master","database":"izqlinmg_electric","data":
[...
Now I want to import this database to Firebase realtime db. But upon uploading I keep getting this error:
Invalid JSON Keys cannot be empty or contain $#[]./
How do I fix this?
2
Answers
The error message is pretty self-explanatory: keys (the things to the left of
:
) in the Firebase Realtime Database cannot contain certain characters, and one or more of your keys contains one of those characters.You’ll have to remove the offending characters and try the import again.
I believe the issue is the array. You need to convert it to an object with
{}
instead of[]
. Other issues I had to solve that were not obvious from the error: