我正在尝试从我的java bean类创建一个json对象,首先我创建一个StringBuffer
并将数据附加到其中,然后将此StringBuffer
转换为String,同时转换此String
进入json对象我收到此错误。
org.apache.sling.commons.json.JSONException: Expected a ':' after a key at character 129 of {data:{"id":"5345345","name":"dsfsdf","dep":"","ssc":"dgffdgfdg"},{"id":"123456","name":"SBI","dep":"654321","ssc":"State Bank"}}
第129页是第二封信。有没有语法问题?
答案 0 :(得分:1)
将您的数据视为对象数组,
你的JSON应该是
{
"data": [
{
"id": "5345345",
"name": "dsfsdf",
"dep": "",
"ssc": "dgffdgfdg"
},
{
"id": "123456",
"name": "SBI",
"dep": "654321",
"ssc": "State Bank"
}
]
}