The Wayback Machine - https://web.archive.org/web/20200718074927/https://github.com/iendeavor/object-visualizer
Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Jul 18, 2020
Jul 15, 2020
src
Jul 18, 2020
Jul 15, 2020
Jul 15, 2020
Jul 12, 2020
Jul 12, 2020
Jul 18, 2020
Jul 18, 2020
Jul 12, 2020

README.md

Object Visualizer

Visualize the JSON object to the DOM.

Live Demo

As same as Chrome's object tree

Feature

Nested values

  • Recursive expand Meta+Click
  • Recursive collapse Meta+Shift+Click

Installation

$ npm install object-visualizer
<script src="https://unpkg.com/object-visualizer"></script>
<link
  type="text/css"
  rel="stylesheet"
  href="https://unpkg.com/object-visualizer/dist/index.css"
/>

How to use

  1. Import the mount function from the module
import { mount } from "object-visualizer";
  1. Query the HTML element to inject the JSON, e.g. <pre id="app"></pre>
//Vanilla JS
const preEl = document.getElementById("app");
//Vanilla JS new dom api
const preEl = document.querySelector("#app");
//jQuery
const preEl = $("#app");
  1. Have your data on a variable

  2. Use mount function

mount(data, preEl);
  1. Thats it!!

License

MIT

You can’t perform that action at this time.