index.html
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../../css/tool/bootstrap.css">
<link href="../../css/tool/jquery.json-viewer.css" type="text/css" rel="stylesheet" />
<style>
body{background-color: #F7F7F7}
</style>
</head>
<body>
<div class="jq22-container">
<div class="container" style="margin-top: 1em;">
<div class="row">
<textarea class="form-control" id="json-input" rows="15" >
</textarea>
<label class="checkbox-inline">
<input type="checkbox" id="collapsed">
收缩所有的节点 </label>
<label class="checkbox-inline">
<input type="checkbox" id="with-quotes">
为Key添加双引号 </label>
<div class="form-group" style="padding: 1em 0;">
<button id="btn-json-viewer" class="btn btn-info" title="run jsonViewer()">转换Json数据</button>
</div>
<pre id="json-renderer"></pre>
</div>
</div>
<script src="jQuery-2.1.4.min.js"></script>
<script src="jquery.json-viewer.js"></script>
<script type="text/javascript">
$(function() {
$('#btn-json-viewer').click(function() {
try {
var input = eval('(' + $('#json-input').val() + ')');
}
catch (error) {
return alert("Cannot eval JSON: " + error);
}
var options = {
collapsed: $('#collapsed').is(':checked'),
withQuotes: $('#with-quotes').is(':checked')
};
$('#json-renderer').jsonViewer(input, options);
});
});
</script>
</body>
</html>