Skip to content

This is a javascript library for displaying json data into a DOM.

Notifications You must be signed in to change notification settings

TeachBoost/json-view

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-view

This is a javascript library for displaying json data into a DOM. link to demo

How to use

include jsonview.css and jsonview.js

 <link rel="stylesheet" type="text/css" href="jsonview.css">
 <script src="jsonview.js"></script>

call the function with arguments

//get json data
var data = '{"name": "json-view","version": "1.0.0"}';

//get target html element
var target = '.root';

jsonView.format(data, target);

Example

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="jsonview.css">
  <script src="jsonview.js"></script>
</head>
<body>
  <div class="root"></div>

  <script type="text/javascript">
    fetch('example.json')
    .then((res)=> {
      return res.text();
    })
    .then((data) => {
      jsonView.format(data, '.root');
    })
    .catch((err) => {
      console.log(err);
    })
  </script>
</body>
</html>

For development install dependencies

$ npm install
$ npm start
open http://localhost:3000/

About

This is a javascript library for displaying json data into a DOM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 81.7%
  • CSS 11.7%
  • HTML 6.6%