"newdynaid": 22,
"isPrimary": "Y",
"isNotNull": "Y",
"scalePrecision": "",
"checkConstraint": "(ABC<>(0))",
"isUnique": "N",
"name": "INDV_ID",
"sizeUnits": "",
"foreignConstraint": "",
我有上面需要在JSP上显示的json片段。我尝试过stringify和parse选项来考虑'&lt;&gt;'作为字符串值,并且在此之后不终止JSON字符串但无法执行此操作。 @BalusC,我希望你能在那里帮助我。
答案 0 :(得分:0)
最后一个逗号将成为一个问题。此外,我不确定你要做什么。这是我最好的猜测:
var data={"newdynaid": 22,
"isPrimary": "Y",
"isNotNull": "Y",
"scalePrecision": "",
"checkConstraint": "(ABC<>(0))",
"isUnique": "N",
"name": "INDV_ID",
"sizeUnits": "",
"foreignConstraint": ""};
function show() {
document.getElementById("out").textContent=JSON.stringify(data).replace(/,/g,",\n");
}
&#13;
<input type="button" value="Show" onclick="show();"><pre id="out"></pre>
&#13;