Firebase - Invalid JSON data or key values. Key values can’t contain $ # [ ] / or

后端 未结 9 2177
陌清茗
陌清茗 2020-12-31 03:34

I\'m trying to import my JSON file into my Firebase but it keeps giving me this error. I don\'t know why this JSON file isn\'t allowed to be imported into since JSONLint say

相关标签:
9条回答
  • 2020-12-31 04:07

    if you created triggered function a lot of. You have to remove triggered functions. Next try again. That way works for me.

    0 讨论(0)
  • 2020-12-31 04:08

    I just spent some time on this and found the issue for me (and likely for many others) when getting this error message. It looks like firebase can only import files with UTF-8 encoding (no BOM)

    I found it strange, as I couldn't re-import the content I had just exported.

    I tried all UTF versions 8, 16 with LE and BE with and without BOM, only UTF-8 works

    I wish firebase did not have this utterly misleading error message

    0 讨论(0)
  • 2020-12-31 04:14

    This was happening for me as well, as a web developer, I looked into the Developers Console and the actual error was because of authentication that Firebase's console was not able to authenticate while validating the JSON files.

    So I did a "refresh" of the web page and it worked.

    0 讨论(0)
  • 2020-12-31 04:18

    My filename was "something-somethingelse", ie it had a '-' character in the filename. Changing it to 'something.json' solved the problem

    So, don't have any special characters in your filenames.

    0 讨论(0)
  • 2020-12-31 04:19

    Two things that might help someone else save a couple of hours of head scratching:

    1) Empty strings are valid JSON keys, they're NOT valid Firebase keys.

    2) While the web tool error message is horrible, the command-line tool actually provides useful information like, say, a line number (nice when you have a 300K+ line file)

    E.g.

    firebase --project database:set / import.json

    to overwrite everything from the root

    0 讨论(0)
  • 2020-12-31 04:22

    The JSON you posted is valid for Firebase, so the issue is not with this JSON. It must be somewhere else in your application.

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