Skip to content

wutility/json-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Performance JSON Viewer

A lightweight, dependency-free JSON viewer that renders JSON data into a human-readable, collapsible tree.

Features

  • Pure JavaScript: No external libraries or frameworks required.
  • Collapsible Nodes: Easily expand and collapse nested objects and arrays.
  • Global Controls: Programmatically expand or collapse all nodes at once.
  • Customizable: Options to control initial collapsed state, max depth, and more.
  • Syntax Highlighting: Differentiates between strings, numbers, booleans, and null values.
  • Modern Styling: Styled with Tailwind CSS for a clean and responsive UI.

json viewer json viewer json viewer json viewer json viewer

Demos

PLayground
Demo Codepen

$ npm i jsnview
# or
$ yarn add jsnview

Usage

import jsnview from "jsnview";

Or include it via jsDelivr CDN (UMD):

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script>
<!-- Access via global object : window.jsnview -->

Usage

Use the following code to initialize the viewer.

const data = {
  key1: "value1",
  key2: 123,
  key3: true,
  key4: [1, 2, 3],
  key5: {
    nestedKey: "nestedValue",
  },
};

const options = {
  collapsed: false,
  showLen: true,
  showType: false,
  showFoldmarker: true,
  maxDepth: Infinity,
};

const viewer = new Jsnview(data, options);

Notes

  • All pull requests are welcome, feel free.

Author

License

Apache License 2.0

About

🔥 High-Performance JSON Viewer Styled with Tailwind CSS for a clean and responsive UI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •