什么是“JSON 标准只允许一个顶级值”?

use*_*911 1 json intellij-idea

在我的 IntelliJ 编辑器中,我有一个 test.json 文件,如下所示。第二个 json 记录显示错误消息“Json 标准只允许一个顶级值”。但这是一个有效的 JSON 文件,对吗?如何摆脱这个烦人的消息?

{"reviewerID": "A2XVJBSRI3SWDI", "asin": "0000031887", "reviewerName": "abigail", "helpful": [0, 0], "title": "Ballet Dress-Up Fairy Tutu", "url": "https://www.amazon.com/dp/0000031887", "brand": "Boutique Cutie", "reviewText": "Perfect red tutu for the price. I baught it as part of my daughters Halloween costume and it looked great on her.", "overall": 5.0, "summary": "Nice tutu", "unixReviewTime": 1383523200, "reviewTime": "11 4, 2013"}
{"reviewerID": "A2G0LNLN79Q6HR", "asin": "0000031887", "reviewerName": "aj_18 \"Aj_18\"", "helpful": [1, 1], "title": "Ballet Dress-Up Fairy Tutu", "url": "https://www.amazon.com/dp/0000031887", "brand": "Boutique Cutie", "reviewText": "This was a really cute tutu the only problem is that it was super short on my 5 yr old daughter. Other than that it was really adorable.", "overall": 4.0, "summary": "Really Cute but rather short.", "unixReviewTime": 1337990400, "reviewTime": "05 26, 2012"}
Run Code Online (Sandbox Code Playgroud)

N M*_*N M 5

如果您想在同一个 json 文件中使用它们,您必须将它们组合为 [ {Obj 1}, {Obj 2} ]。否则 json 文件将包含两个字典对象,并且它只能有一个顶级对象。