在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:summerstyle/jsonTreeViewer开源软件地址:https://github.com/summerstyle/jsonTreeViewer开源编程语言:JavaScript 74.9%开源软件介绍:jsonTreeViewer and jsonTree libraryThe library and the viewer released under the MIT license (LICENSE.txt). jsonTreeViewerA simple json formatter/viewer based on jsonTree library and app.js framework. Clone with submodules (including App.js library):
Online: http://summerstyle.github.io/jsonTreeViewer
jsonTree library (JSON pretty-printer)A simple lightweight pure-javascript library for drawing tree of json-nodes from json-object.
You can get json-object from json-string by Demo: http://summerstyle.github.io/jsonTreeViewer The library includes only 2 files - How to use:html: <link href="libs/jsonTree/jsonTree.css" rel="stylesheet" />
<script src="libs/jsonTree/jsonTree.js"></script> javascript: // Get DOM-element for inserting json-tree
var wrapper = document.getElementById("wrapper");
// Get json-data by javascript-object
var data = {
"firstName": "Jonh",
"lastName": "Smith",
"phones": [
"123-45-67",
"987-65-43"
]
};
// or from a string by JSON.parse(str) method
var dataStr = '{ "firstName": "Jonh", "lastName": "Smith", "phones": ["123-45-67", "987-65-43"]}';
try {
var data = JSON.parse(dataStr);
} catch (e) {}
// Create json-tree
var tree = jsonTree.create(data, wrapper);
// Expand all (or selected) child nodes of root (optional)
tree.expand(function(node) {
return node.childNodes.length < 2 || node.label === 'phoneNumbers';
}); You can create many trees on one html-page. The available methods of each json tree:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论