Vue JSONEditor Component

1.4.5 · abandoned · verified Sun Apr 19

v-jsoneditor is a Vue.js wrapper component for the popular `jsoneditor` library, providing a powerful and customizable JSON editor interface within Vue applications. It allows users to view, edit, format, and validate JSON data through a user-friendly GUI or code editor. The current stable version is 1.4.5, with the last update in September 2021. Due to the lack of recent activity, the project appears to be unmaintained, potentially limiting its compatibility with newer Vue versions (e.g., Vue 3) or the latest features and security patches of the underlying `jsoneditor` library. Its primary differentiator is its straightforward integration into Vue 2 projects.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart initializes a Vue 2 application, globally registers `v-jsoneditor`, and displays a basic editor component with initial JSON data and custom options.

import Vue from 'vue';
import VJsoneditor from 'v-jsoneditor';

Vue.use(VJsoneditor);

new Vue({
  el: '#app',
  data() {
    return {
      jsonData: {
        message: 'Hello V-JSONEditor!',
        version: '1.0.0',
        isActive: true,
        items: [
          { id: 1, name: 'Item A' },
          { id: 2, name: 'Item B' }
        ]
      },
      editorOptions: {
        mode: 'code',
        modes: ['code', 'tree', 'form', 'view', 'text'],
        onError: (err) => {
          console.error('JSONEditor error:', err);
        }
      }
    };
  },
  methods: {
    handleError(err) {
      console.error('v-jsoneditor component error:', err);
    }
  },
  template: `
    <div>
      <h1>Vue JSON Editor Demo</h1>
      <v-jsoneditor
        v-model="jsonData"
        :options="editorOptions"
        :plus="true"
        height="400px"
        @error="handleError"
      />
      <p>Current JSON: {{ JSON.stringify(jsonData) }}</p>
    </div>
  `,
});

view raw JSON →