【发布时间】:2016-03-10 00:12:39
【问题描述】:
我有一个像这样的简单 JSON 对象:
String jsonString = new String( "{
"table": { "column1" : "description1",
"column2" : "description2",
"columnN" : "descriptionN" } }" );
我需要做的是使用带有 JSTL 的 forEach 创建一个 HashMap 或 Map 来生成这个 HTML:
<table>
<tr>
<td id="column1">description1</td>
<td id="column2">description2</td>
<td id="columnN">descriptionN</td>
</tr>
...
</table>
JSON 结构无法更改。
【问题讨论】:
-
使用 JSON 库怎么样?
-
字符串操作应该怎么做?
-
是的,这就是想法,但如何?我正在尝试迭代“表”,但我不知道该怎么做?