我有一个包含json对象的字符串(1x878683 char)。当我解析它们时,我得到了一个包含第一个json对象的1x1结构。其余的json物体都被滑雪了。我使用这个matlab类JSON.m使用JSON.parse方法解析它们。 我想要解析所有json对象,并且我希望每个json对象都是单元数组的元素。怎么做?
这是我的json字符串的样子:
" {"Surname":" bla bla bla", "OtherNames":"pla pla pla", "Affiliation":"bla bla bla"}
{"Surname":" bla bla bla", "OtherNames":"pla pla pla", "Affiliation":"bla bla bla"}
{"Surname":" bla bla bla", "OtherNames":"pla pla pla", "Affiliation":"bla bla bla"}"
答案 0 :(得分:0)
JSON data sets should always have a root object. You have defined three separate objects. You'll want these to be contained in a root object, in an array. Like this:
{
"persons": [{
"Surname": " bla bla bla",
"OtherNames": "pla pla pla",
"Affiliation": "bla bla bla"
}, {
"Surname": " bla bla bla",
"OtherNames": "pla pla pla",
"Affiliation": "bla bla bla"
}, {
"Surname": " bla bla bla",
"OtherNames": "pla pla pla",
"Affiliation": "bla bla bla"
}]
}