<html> <body> <div id="result"> </div> <div> <textarea style="100%;height:300px" id="code"></textarea><br /> <button onclick="anyz()">分析</button> </div> <script> function anyz() { var jsonStr = document.getElementById("code").value; var k; eval("k = " + jsonStr); for (var i = 0; i < k.mainOrders.length; i++) { var price = k.mainOrders[i].payInfo.actualFee; var status = k.mainOrders[i].statusInfo.text; var title = ""; for (var j = 0; j < k.mainOrders[i].subOrders.length; j++) { if (title != "") title += "、"; title += k.mainOrders[i].subOrders[j].itemInfo.title; } var date = k.mainOrders[i].orderInfo.createDay var part = document.createElement("p"); part.innerHTML = title + "," + price + "," + status + "," + date document.getElementById("result").appendChild(part); } } </script> </body> </html>