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

时间:2023-01-30 22:45:44

I am attempting to import a .json file to parse.com, and I have encountered many errors while doing so. I solved them sequentially, but after I click finish import, I get the error

我正在尝试将.json文件导入到parse.com,在此过程中我遇到了许多错误。我按顺序解决了它们,但是在我点击finish import后,我得到了错误

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

My JSON script is, as far as I know, perfectly fine. But I only started using JSON two hours ago, so I'm sure there's something wrong with it.

据我所知,我的JSON脚本非常好。但是我在两个小时前才开始使用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

4 个解决方案

#1


10  

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。

#2


3  

You need to remove the comma's after name2 and then insert a comma between nameChunk1 and nameChunk2. Valid JSON below:

您需要删除name2后面的逗号,然后在nameChunk1和nameChunk2之间插入一个逗号。有效的JSON如下:

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

#3


2  

use any json validator like http://jsonlint.com/ to validate your JSON.

使用任何json验证器(如http://jsonlint.com/)来验证json。

currect JOSN is :

电子商务JOSN是:

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

#4


1  

There are two issues with the jason:

杰森有两个问题:

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

Below is the valid json:

下面是有效的json:

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

#1


10  

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。

#2


3  

You need to remove the comma's after name2 and then insert a comma between nameChunk1 and nameChunk2. Valid JSON below:

您需要删除name2后面的逗号,然后在nameChunk1和nameChunk2之间插入一个逗号。有效的JSON如下:

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

#3


2  

use any json validator like http://jsonlint.com/ to validate your JSON.

使用任何json验证器(如http://jsonlint.com/)来验证json。

currect JOSN is :

电子商务JOSN是:

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

#4


1  

There are two issues with the jason:

杰森有两个问题:

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

Below is the valid json:

下面是有效的json:

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