開発環境 |
メモ帳 |
実行環境 |
Internet Explorer 11 |
JsonTest.html
<html>
<head>
<title>JsonTest</title>
<script type="text/javascript">
<!--
function conv()
{
try {
var obj = JSON.parse(document.f1.src.value);
obj.test = true; // 追加テスト
document.f1.dst.value = JSON.stringify(obj);
}
catch (e) {
document.f1.dst.value = e;
}
}
// -->
</script>
</head>
<body>
<form name="f1">
<textarea name="src" cols=80 rows=10>
{"ary":[0,1,2], "obj":{"a":0,"b":1,"c":2} }
</textarea><br>
<br>
<input type="button" value="↓" onClick="conv()"><br>
<br>
<textarea name="dst" cols=80 rows=10></textarea><br>
</form>
</body>
</html>
最終更新:2014年05月10日 19:50