简体   繁体   English

JSON无效字符'}'正在寻找对象键字符串的开头

[英]JSON invalid character '}' looking for beginning of object key string

I am attempting to import a .json file to parse.com , and I have encountered many errors while doing so. 我试图导入.json文件parse.com ,虽然这样做我也遇到了很多的错误。 I solved them sequentially, but after I click finish import , I get the error 我按顺序解决了它们,但是在我点击finish import ,我收到错误

invalid character '}' looking for beginning of object key string

My JSON script is, as far as I know, perfectly fine. 据我所知,我的JSON脚本非常好。 But I only started using JSON two hours ago, so I'm sure there's something wrong with it. 但我两小时前才开始使用JSON ,所以我确定它有问题。

{
  "results": [{
    "nameChunk1": [{
      "name1": "Sean",
      "name2": "Noah",
    }]
    "nameChunk2": [{
      "name1": "Joseph",
      "name2": "Sam",
    }]
  }]
}

So, where is the mysterious invalid } ? 那么,神秘的无效}哪里? I fear there are many... Keep in mind I am using JSON for importing data into parse.com 我担心有很多......请记住我使用JSON将数据导入parse.com

Correct your JSON syntax: 更正您的JSON语法:

{
  "results": [{
     "nameChunk1": [{
        "name1": "Sean",
        "name2": "Noah" 
     }],
     "nameChunk2": [{
       "name1": "Joseph",
       "name2": "Sam"
     }]
  }]
}

Observe that I have added , after each array.. and removed , after name2 key. 观察到,我已经加入,每个阵列..后除去,之后name2键。

Always use validators such as http://jsonlint.com/ to validate your JSON. 始终使用http://jsonlint.com/等验证程序来验证您的JSON。

Use any JSON validator like http://jsonlint.com/ to validate your JSON. 使用任何JSON验证器(如http://jsonlint.com/)来验证您的JSON。

Correct JSON is: 正确的JSON是:

{
  "results": [{
     "nameChunk1": [{
        "name1": "Sean",
        "name2": "Noah" 
     }],
     "nameChunk2": [{
       "name1": "Joseph",
       "name2": "Sam"
     }]
  }]
}

You need to remove the comma's after name2 and then insert a comma between nameChunk1 and nameChunk2 . 您需要删除name2之后的逗号,然后在nameChunk1nameChunk2之间插入逗号。 Valid JSON below: 以下有效JSON:

{
  "results": [{
    "nameChunk1": [{
      "name1": "Sean",
      "name2": "Noah"
    }],
    "nameChunk2": [{
      "name1": "Joseph",
      "name2": "Sam"
    }]
  }]
}

There are two issues with the JSON: JSON有两个问题:

  1. There should be no ',' after last element of an object 在对象的最后一个元素之后应该没有','
  2. There should be a comma to separate two elements 应该有一个逗号分隔两个元素

Below is the valid JSON: 以下是有效的JSON:

{
  "results": [{
    "nameChunk1": [{
      "name1": "Sean",
      "name2": "Noah"
    }],
    "nameChunk2": [{
      "name1": "Joseph",
      "name2": "Sam"
    }]
  }]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 json 格式无效,请检查。 原因:寻找对象键字符串开头的无效字符“a” - Invalid json format, please check. Reason: invalid character 'a' looking for beginning of object key string JSON int密钥发布数据e2e(寻找对象密钥字符串开头的无效字符“ 1”) - JSON int key issue data e2e (invalid character '1' looking for beginning of object key string) JSON无法写入创世纪块:无效字符'\\\\'寻找对象密钥字符串的开头 - JSON failed to write genesis block: invalid character '\\' looking for beginning of object key string Xamarin&Golang-{[]}无效字符'\\ x00'寻找对象密钥字符串的开头 - Xamarin & Golang - { []} invalid character '\x00' looking for beginning of object key string 服务器错误 (BadRequest):寻找 object 键字符串开头的无效字符“\\” - Error from server (BadRequest): invalid character '\\' looking for beginning of object key string Golang无效字符'b'寻找值的开始 - Golang invalid character 'b' looking for beginning of value golang websocket.JSON.Receive无效字符'q'寻找值的开头 - golang websocket.JSON.Receive invalid character 'q' looking for beginning of value 从精读的HTTP中解组JSON:无效字符寻找值的开头 - Go unmarshalling JSON from compessed HTTP: invalid character looking for beginning of value 解组 JSON 返回错误:无效字符 '\\x1f' 寻找值的开头 - Unmarshalling JSON returns an error: invalid character '\x1f' looking for beginning of value Parse.com说“寻找值的开头的无效字符'\\” - Parse.com says “invalid character '\'' looking for beginning of value”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM