Component for rendering a tree view of JSON

Component for rendering a tree view of JSON

A collapsable tree view for JSON. This package is loosely based on vue-json-tree-view with a series of upgrades.

Vue JSON Component

npm version TypeScript npm bundle size License: MIT code style: prettier


A collapsable tree view for JSON. This package has some similarites with vue-json-tree-view so I'll address the differences below. I'm not contributing this back to that package because it would require breaking API changes, and the code is entirely different. Contributions welcome!

demo image


This package has a few major improvements over predecessors: builds, styles, and customization. For builds, this package ships CommonJS, Module, and UNPKG builds with no dependencies. vue-json-tree-view bundles in lots of dependencies -- including lodash. I also export global Vue imports, local Vue imports, and TypeScript declarations. The code itself is about as small as it can be while being easy to follow.

The styles in this package are all scoped, with key colors still being customizable. There are no extra margins or overflow rules and text properties are all inherited from the page. This makes the view much easier to integrate anywhere you need it.

The default color theme is based on solarized, and font weights are modified to increase readability.



npm i vue-json-component
yarn add vue-json-component

Import Locally

import { JSONView } from "vue-json-component";
export default Vue.extend({
  components: { "json-view": JSONView }

Import Globally

import JSONView from "vue-json-component";


  <json-view :data="data" />


The font size and font family are inherited from the page.


  • data (JSON): The valid JSON object you want rendered as a tree.
  • rootKey (String): The name of the top level root key; defaults to root.
  • maxDepth (Number): Depth of the tree that is open at first render; defaults to 1.
  • styles (Object): Override the color styles. Defaults shown below.
const defaultStyles = {
  key: "#002b36",
  valueKey: "#073642",
  string: "#268bd2",
  number: "#2aa198",
  boolean: "#cb4b16",
  null: "#6c71c4",
  arrowSize: "6px"


    :styles="{ key: '#0977e6' }"




Hot-Reload Hostapp

yarn serve

Build Component

yarn build

Lints and fixes files

yarn lint


Contributions are welcome via pull request. If you want to discuss your feature before committing development time, feel free to open an issue and we can refine the idea.


Github Repository