【发布时间】:2015-06-30 17:31:13
【问题描述】:
我收到了以下 JSON 格式,但我很难获得这些信息。我想把它放到一个数据表中。
"data": {
"HeadingOne":{
"Columns":["Row1", "Row2"],
"Data":[["firstData", "secondData"]]
}
}
我被告知我应该能够访问这些数据,但我完全不知道如何访问数据表中的“firstData”。 (来自datatables.net)这是我尝试过的
$(document).ready(function() {
$('#example').dataTable( {
"ajax": "<%= request.getContextPath()%>/ajax/mastermenu.txt",
"columns":[
{"data": "HeadingOne.Data.Row1"}
]
} );
} );
HTML:
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Row1</th>
<th>Row2</th>
</tr>
</thead>
</table>
【问题讨论】:
-
这个 json 无效
-
这是无效的 JSON,对象未正确关闭。
-
缺少
},这是 JSON 的一部分吗?
标签: javascript ajax json formatting nested