I have a string in a Java server application that is accessed using AJAX.(我在使用AJAX访问的Java服务器应用程序中有一个字符串。)
It looks something like the following:(它看起来像下面这样:)
var json = [{
"adjacencies": [
{
"nodeTo": "graphnode2",
"nodeFrom": "graphnode1",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#EBB056",
"$type": "triangle",
"$dim": 9
},
"id": "graphnode1",
"name": "graphnode1"
},{
"adjacencies": [],
"data": {
"$color": "#EBB056",
"$type": "triangle",
"$dim": 9
},
"id": "graphnode2",
"name": "graphnode2"
}];
When the string gets pulled from the server, is there an easy way to turn this into a living JavaScript object (or array)?(当字符串从服务器中拉出时,是否有一种简单的方法可以将其转换为活动的JavaScript对象(或数组)?)
Or do I have to manually split the string and build my object manually?(或者我是否必须手动拆分字符串并手动构建我的对象?)
ask by mj_ translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…