Vue component that renders JSON data in a collapsible tree structure.


> Use in browsers

1. Include the CSS and JS along with Vue, so you get a <json-tree> component.

<script src=""></script>
<script src=""></script>

2. Instantiate the component with your data.

<div id="app"></div>
  new Vue({
    template: '<json-tree :raw="sample"></json-tree>',
    el: '#app',
    data: {
      sample: '{"foo": "bar"}'

> Use with webpack and vue-loader

1. Install the vue-json-tree package via NPM.

npm install --save vue-json-tree

2. Import the SFC (with CSS embedded) and register it as a component, either globally or in another component.

import JsonTree from 'vue-json-tree'
Vue.component('json-tree', JsonTree)


> raw (string, optional)

The data you want to present in the tree view. Must be a valid JSON string, otherwise it fails.

> data (any, optional)

If your JSON data has already been parsed, bind this one instead. Must be something that can be produced by JSON.parse().

> level (number, optional)

Sometimes the data structure is very deep. You could set them to collapsed on load. By default all levels are expanded.



> Want to fix bugs or implement new features?

1. Grab the source code from GitHub.

git clone

2. Install dependencies via NPM.

npm install

3. Run in dev mode and start to hack.

npm run dev

4. Make sure you run the tests.

npm run test

5. Build the dist files.

npm run dist

MIT © Leo Deng 2019