Categories: CSSScriptWeb Design

Render JSON Data As A Tree View – json-view

Yet another JSON viewer library that renders your JSON data as a collapsible and expandable tree structure for better readability.

Table of Contents

Toggle

How to use it:

Download and import the json-view’s files into the document.

<link rel="stylesheet" href="/path/to/dist/jsonview.bundle.css" />

The library uses Font Awesome for the collapse/expand icons.

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<script src="/path/to/dist/jsonview.bundle.js"></script>

Create a container to place the JSON viewer.

<div class="root"></div>

Format and render your JSON data in the container.

let data = '{}';
let target = '.root';
jsonView.format(data, target);

API methods.

// expand tree
jsonView.expandChildren(tree);

// collapse tree
jsonView.collapseChildren(tree);

// treverse tree object
jsonView.traverseTree(tree, function(node) {
  console.log(node);
});

Changelog:

12/03/2025

  • v2.7.6: bugfix

03/29/2025

  • v2.7.6: bugfix

10/17/2023

  • v2.7.5: bugfix

10/07/2023

  • v2.7.4: bugfix

07/07/2023

  • v2.7.3: bugfix

07/05/2022

  • v2.7.2: bugfix

01/11/2022

  • v2.7.0

05/26/2020

  • Use scss

05/26/2020

  • Bugfix

05/25/2020

  • Fix false boolean value

05/23/2020

  • Updated

10/09/2019

  • Fix caret directions

The post Render JSON Data As A Tree View – json-view appeared first on CSS Script.

rssfeeds-admin

Share
Published by
rssfeeds-admin

Recent Posts

Don’t Miss This Phenomenal Price Drop on the FlashForge AD5X Multi-Color 3D Printer at AliExpress

An excellent 3D printer with multi-color print capability just got a huge price drop ahead…

7 minutes ago

The AMD Radeon 9070 XT Graphics Card Creeps Ever Closer to MSRP During Amazon’s Memorial Day Sale

Similar to every other high-end GPU on the market, the AMD Radeon 9070 XT graphics…

8 minutes ago

Stranger Things Creators Promise They’ll Reveal Eleven’s Fate in 20 Years

Don't worry, the Duffer Brothers will be happy to tell you what happened to Eleven…

8 minutes ago

3 Tactics Mature SOCs Use to Eliminate Critical Business Risk

A data breach makes headlines for a day. The damage it leaves behind lasts years.  Critical…

23 minutes ago

Linus Torvalds Says AI Bug Reports Overwhelm Linux Security Lists

Linus Torvalds has publicly declared that the Linux kernel’s private security mailing list has become…

23 minutes ago

Critical n8n Vulnerabilities Expose Automation Nodes to Full RCE

A fresh set of critical vulnerabilities in the popular workflow automation platform n8n is raising…

44 minutes ago

This website uses cookies.