为什么这个JSON无效?

时间:2013-10-18 15:38:36

标签: json

JSONLint给了我一个错误"期待' EOF'"用逗号隔开" blah" s。我很难过。

{
    "blah": false,
    "heynow": [
        {
            "Name": "one",
            "Duration": 2,
            "DurationUnit": "Hours"
        },
        {
            "Name": "two",
            "Duration": 40,
            "DurationUnit": "Minutes"
        }
    ]
},
{
    "blah": true,
    "heynow": [
        {
            "Name": "three",
            "Duration": 2,
            "DurationUnit": "Hours"
        },
        {
            "Name": "four",
            "Duration": 40,
            "DurationUnit": "Minutes"
        }
    ]
}

2 个答案:

答案 0 :(得分:3)

两个JSON对象需要包装。我建议一个阵列。例如:

[
    {
         "blah": false,
// ...
    },
    {
         "blah": true,
//...
    }
]

答案 1 :(得分:1)

这看起来像一个有两个对象的数组。在这种情况下,数组用JSON中的[]括起来表示。

相关问题