Migrating data into Firebase from MySQL

后端 未结 2 1079
走了就别回头了
走了就别回头了 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: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.

提交回复
热议问题