This is a TypeScript project that converts a JavaScript object into a JSON tree.
This is influenced by jsonTreeViewer.
Themes are adapted from highlight.js.
To install the dependencies, run:
pnpm installTo use JSON Tree in your project, import the createTree function and call it with your JSON object and the target DOM element:
import { createTree } from "./tree";
const jsonObject = {
// Your JSON object here
};
const targetElement = document.getElementById("json-tree-container");
createTree(jsonObject, targetElement);To download and extract themes from highlight.js, run the following script:
./scripts/download-themes.shThis script downloads and extracts colors from highlight.js themes and saves them as CSS variable definitions in the static/css/themes directory.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.