A pure JavaScript library for rendering JSON objects in HTML with a collapsible tree view. Version 2.2.0 is the current stable release. The package is lightweight, supports TypeScript types, and provides customization options including hover preview, themes, and animation toggles. It is an ESM-only, browser-oriented library that requires the JSON input to be an object or array (not a string).
npm install json-formatter-js-bbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Renders a JSON object as a collapsible HTML tree with hover preview and custom depth.
Parse the string first: const formatter = new JSONFormatter(JSON.parse(str));
Pass 0 as second argument: new JSONFormatter(json, 0)
Use formatter.openAtDepth(depth) after render() instead of passing open to constructor.
Use dynamic import() or switch to ESM.
Use 'import JSONFormatter from 'json-formatter-js-bb'' (ESM) and invoke with 'new'.
const formatter = new JSONFormatter(json); const element = formatter.render(); document.body.appendChild(element);
No dependency data recorded yet.