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

Confused Retailers Receive Mysterious Shipments Containing One of the PS4’s Rarest Games, Poop Slinger

A bunch of mom-and-pop video game stores have received mysterious shipments of one of the…

14 minutes ago

This $1,800 Power Lift Recliner and Massage Chair Is Just $375 During the Wayfair Memorial Day Sale

I can think of few activities I'd enjoy more than playing a video game on…

14 minutes ago

Buy One Board Game or Puzzle, Get One 50% Off Through This Stellar Offer at Target

Looking for some new board games to play, or maybe a puzzle to piece together…

15 minutes ago

Sony Announces PlayStation Plus Price Increases ‘Due to Ongoing Market Conditions’

Sony has announced price increases for its subscription service, PlayStation Plus. PlayStation Plus is Sony’s…

15 minutes ago

Dread the Hall H Reveals the True Horror of Comic-Con

Comic-Con can be a scary place, but what if it became a breeding ground for…

15 minutes ago

People Are Betting Thousands of Dollars on Who Will Die at the End of The Boys Season 5

People are betting thousands of dollars on who will die at the end of the…

1 hour ago

This website uses cookies.