【问题标题】:Firebase JSON import error Unexpected token ":"Firebase JSON 导入错误意外的令牌“:”
【发布时间】:2021-04-06 07:41:20
【问题描述】:

对 Firebase 进行测试导入(这里不是全职开发人员)并且对 Firebase 和 node.js 非常陌生,我正在导入以下文件,之后出现以下错误。

{
    "__collections__": {
        "scores": {
            "comment": "test comment",
            "companyId": "ec24fmJeLA93l5jWPAN0",
            "date": 1607770800.00,
            "email": "bdavis@wftst.com",
            "score": 3,
            "tags": [
                "Supervisor Issues",
                "Communication Issues"
            ],
        "userId": "a8waViyRAJWGr2h6Gc3u",
        "__collections__": {}
    }
}

运行导入后,我的终端上出现以下错误。

*JSONError: Unexpected token ":" (0x3A) in JSON at position 30 while parsing near "...ctions__\": \n\"scores\": {\n    \"comment\": \"..." in TEST_BDAVIS.json 
  1 | {
  2 | "__collections__": 
> 3 | "scores": {
    |         ^
  4 |     "comment": "test comment",
  5 |     "companyId": "ec24fmJeLA93l5jWPAN0",
  6 |     "date": 1607770800.00,
JSONError: Unexpected token ":" (0x3A) in JSON at position 30 while parsing near "...ctions__\": \n\"scores\": {\n    \"comment\": \"..." in TEST_BDAVIS.json 
  1 | {
  2 | "__collections__": 
> 3 | "scores": {
    |         ^
  4 |     "comment": "test comment",
  5 |     "companyId": "ec24fmJeLA93l5jWPAN0",
  6 |     "date": 1607770800.00,
    at module.exports (/usr/local/lib/node_modules/node-firestore-import-export/node_modules/parse-json/index.js:29:21)
    at parse (/usr/local/lib/node_modules/node-firestore-import-export/node_modules/load-json-file/index.js:15:9)
    at Object.module.exports [as default] (/usr/local/lib/node_modules/node-firestore-import-export/node_modules/load-json-file/index.js:18:47)*

【问题讨论】:

    标签: node.js json firebase parsing import


    【解决方案1】:

    在您提供的 JSON 中,似乎缺少 }。你的整个文件应该在哪里结束,以及你的第一个 __collections__scores 部分?这可能是错误的原因。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-26
      • 2014-03-31
      • 1970-01-01
      • 2016-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多