我想遍历一个JSONArray。例如:
[{"attribute_name":"222","value":"333","monitor_name":"111"}, {"attribute_name":"bbb","value":"ccc","monitor_name":"aaa"}]
我应该循环浏览JSONArray中的每个JSONObject,并获取该对象的每个键的值。我试过这样的方法。<c:forEach var="eachEntry" items="${widgetDataForAll}"></c:forEach>
循环,但它说
javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
另外,我不知道如何获取每个键的值。
<c:forEach begin="0" end="${jsonArray.length() -1}" var="i">
${jsonArray.getJSONObject(i).getString("attribute_name")}
${jsonArray.getJSONObject(i).getString("value")}
${jsonArray.getJSONObject(i).getString("monitor_name")}
</c:forEach>