UNPKG

@pgrabovets/json-view

Version:

This is a javascript library for displaying json data into a DOM. [link to demo](http://pgrabovets.github.io/json-view/)

26 lines (24 loc) 545 B
<!DOCTYPE html> <html> <head> <title>jsonview demo</title> </head> <body> <div class="root"></div> <script type="text/javascript" src="jsonview.js"></script> <script type="text/javascript"> fetch('example2.json') .then((res)=> { return res.text(); }) .then((data) => { const tree = jsonview.create(data); jsonview.render(tree, document.querySelector('.root')); jsonview.expand(tree); }) .catch((err) => { console.log(err); }) </script> </body> </html>