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>
Sponsored

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

Sponsored
  • 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

Qualcomm won’t be announcing Windows gaming handhelds at GDC after all

In January, Qualcomm hinted to The Verge that it might finally bring its powerful Arm-based…

7 minutes ago

DHS reportedly detained a Columbia University student and content creator

Students are seen on the campus of Columbia University on April 14, 2025, in New…

7 minutes ago

Today’s Best Deals: Pokémon Booster Bundle, Huge Woot Video Game Sale, and MTG x TMNT Boosters

If you’ve been waiting to grab any video games, today might be the day. On…

29 minutes ago

Samson: A Tyndalston Story Plays Like a Brawler Set in Max Payne’s New York – IGN Fan Fest

I first took notice of Samson: A Tyndalston Story when its team of former Just…

31 minutes ago

Stardew Valley Creator Unveils Two New Marriageable Characters Coming in 1.7

Stardew Valley creator Eric Barone (ConcernedApe) has released a 10th anniversary video revealing, among other…

31 minutes ago

Highguard Reportedly Has Less Than 20 Devs Working on It Following Mass Layoffs at Wildlight

Highguard studio Wildlight Entertainment reportedly has less than 20 people remaining to work on the…

32 minutes ago

This website uses cookies.