Migrating data into Firebase from MySQL

后端 未结 2 1069
走了就别回头了
走了就别回头了 2020-12-02 11:04

I have an existing PHP/MySQL app which I am trying to migrate to AngularJS/Firebase, just as a way to learn these newer technologies.

The app has its own schema of t

相关标签:
2条回答
  • 2020-12-02 11:25

    Just in case anyone else comes across this question in the future there is a much easier way of doing this.

    You can export your MySQL tables to a CSV file using a tool like SQLYog.

    Once you have your CSV file you can then convert that to a JSON format using a free online tool like this one: http://www.convertcsv.com/csv-to-json.htm

    I just imported 40 tables from MySQL to Firebase in about 15 minutes. Hope that helps someone!

    0 讨论(0)
  • 2020-12-02 11:36

    Your JSON is not valid. Change it to this to be valid:

    [{"id":"1","word":"cat","wordmeaning":"a mammal species","wordlength":"3"},
    {"id":"2","word":"catapult","wordmeaning":"throwing device","wordlength":"8"},
    {"id":"3","word":"cart","wordmeaning":"something to carry things in","wordlength":"4"}]
    

    So these are the changes:

    1. use double-quotes instead of single-quotes
    2. put (double) quotes around the keys, not just the values

    You may want to consider not quoting the values of id and wordlength, since these properties seem to be numeric.

    Edit

    These two online tools seem to validate the JSON correctly (or at least in line with what Firebase expects):

    • http://www.jslint.com/
    • http://jsonlint.com/

    The second one also pretty prints the JSON, so that might be a reason to prefer one or the other.

    0 讨论(0)
提交回复
热议问题