You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@souljorje/vue-json-pretty

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@souljorje/vue-json-pretty

A JSON tree view component that is easy to use and also supports data selection.

latest
Source
npmnpm
Version
1.8.7
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Vue Json Pretty

A Vue component for rendering JSON data as a tree structure.

Use Vue2, see 1.x.

Use Vue3, see master.

Build Status npm package GitHub license Sizes NPM downloads Issues

English | 简体中文

Features

  • As a JSON Formatter.
  • Get item data from JSON.
  • Support big data.

Environment Support

  • Modern browsers, Electron and Internet Explorer 11 (with polyfills)
  • Server-side Rendering
IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Electron
Electron
IE11, Edgelast 10 versionslast 10 versionslast 10 versionslast 2 versions

Using NPM or Yarn

$ npm install vue-json-pretty --save
$ yarn add vue-json-pretty

Usage

The CSS file is included separately and needs to be imported manually. You can either import CSS globally in your app (if supported by your framework) or directly from the component.

<template>
  <div>
    <vue-json-pretty :path="'res'" :data="{ key: 'value' }" @click="handleClick"> </vue-json-pretty>
  </div>
</template>

<script>
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';

export default {
  components: {
    VueJsonPretty,
  },
};
</script>

Use Nuxt.js

  • In plugins/vue-json-pretty.js
import Vue from 'vue'
import VueJsonPretty from 'vue-json-pretty'

Vue.component("vue-json-pretty", VueJsonPretty)
  • In nuxt.config.js
css: [
  'vue-json-pretty/lib/styles.css'
],
plugins: [
  '@/plugins/vue-json-pretty'
],

Props

  • If you are using only the normal features (JSON pretty), just focus on the base properties.
  • If you are using higher features (Get data), you can use base and higher attributes.
AttributeLevelDescriptionTypeDefault
datanormalJSON dataJSON object-
deepnormalData depth, data larger than this depth will not be expandednumberInfinity
deepCollapseChildrennormalWhether children collapsed by deep prop should also be collapsedbooleanfalse
showLengthnormalWhether to show the length when closedbooleanfalse
showLinenormalWhether to show the linebooleantrue
showDoubleQuotesnormalWhether to show doublequotes on keybooleantrue
virtualnormalWhether to use virtual scrolling, usually used for big databooleanfalse
itemHeightnormalThe height of each item when using virtual scrollingnumberauto
virtualLinesnormalThe number of lines to render when virtual scrolling is enablednumber10
v-modelhigherDefines value when the tree can be selectedstring, array-
pathhigherRoot data pathstringroot
pathSelectablehigherDefines whether a data path supports selectionfunction(path, content)-
selectableTypehigherDefines the selected type, this feature is not supported by defaultmultiple, single-
showSelectControllerhigherWhether to show the select controller at leftbooleanfalse
selectOnClickNodehigherWhether to change selected value when click nodebooleantrue
highlightSelectedNodehigherHighlight current node when selectedbooleantrue
collapsedOnClickBracketshigherCollapsed controlbooleantrue
customValueFormatterhigherA function that can return different html or strings to display for values in the data.function(data, key, path, defaultFormatResult)-

Events

Event NameDescriptionCallback Parameters
clicktriggered when a data item is clicked(path, data)
changetriggered when the selected value changed (only the selectableType not null)(newVal, oldVal)

Major Contributors

Keywords

vue

FAQs

Package last updated on 02 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts