1. vue-json-tree
Vue component that renders JSON data in a collapsible tree structure.
vue-json-tree
Package: vue-json-tree
Created by: myst729
Last modified: Mon, 23 May 2022 16:03:17 GMT
Version: 0.4.3
License: MIT
Downloads: 12,603
Repository: https://github.com/myst729/vue-json-tree

Install

npm install vue-json-tree
yarn add vue-json-tree

vue-json-tree

CircleCI
NPM
License

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

usage

use in browsers

  • Include the CSS and JS along with Vue, so you get a <json-tree> component.
 <script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/json-tree.js"></script>
  • Instantiate the component with your data.
 <div id="app"></div>
<script>
  new Vue({
    template: '<json-tree :raw="sample"></json-tree>',
    el: '#app',
    data: {
      sample: '{"foo": "bar"}'
    }
  })
</script>

use with webpack and vue-loader

  • Install the vue-json-tree package via NPM.
 npm install --save vue-json-tree
  • 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)

props

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.

demo

https://myst729.github.io/vue-json-tree/

MIT © Leo

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code