json-editor-vue is an isomorphic Vue component that functions as a comprehensive JSON editor, viewer, formatter, and validator. It leverages the underlying `vanilla-jsoneditor` library to provide its core functionality. The package is actively maintained, with the current stable version being v0.18.1, reflecting a frequent update schedule that includes both bug fixes and feature enhancements, such as regular upgrades to its `vanilla-jsoneditor` dependency. Key differentiators include its robust support for Server-Side Rendering (SSR) in Nuxt environments, comprehensive validation capabilities (indicated by AJV keywords), and broad compatibility across Vue 2 and Vue 3 versions. It offers multiple editing modes (text, tree, table) and handles large JSON documents efficiently, partly due to its use of `destr` for deserialization.
npm install json-editor-vueVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate `json-editor-vue` into a Vue 3 component using the Composition API. It showcases data binding with `v-model`, setting the editor mode, enabling UI elements like the menu and navigation bar, and handling `update:json` and `error` events for robust interaction. Types for `Mode` and `JSONContent` are imported from `vanilla-jsoneditor` for type safety.
Review any code that relies on deep merging of component properties or specific `JSON.parse` behaviors. Adjust property assignment logic to explicitly handle deep merges if required, or ensure configurations are structured to accommodate shallow merging.
Update import statements to retrieve `Mode` directly from the upstream `vanilla-jsoneditor` package: `import type { Mode } from 'vanilla-jsoneditor';`.Always use the default import syntax: `import JsonEditorVue from 'json-editor-vue'`.
When upgrading `json-editor-vue`, it is highly recommended to also consult the `vanilla-jsoneditor` changelog for potential breaking changes or significant feature updates. Thoroughly test your application after any upgrade.
Ensure `json-editor-vue` is installed via your package manager (`npm install json-editor-vue` or `yarn add json-editor-vue`). Verify your build tool's configuration for alias resolution and ensure it correctly handles Vue component imports. For Nuxt, ensure it's imported correctly within a Nuxt plugin or component.
Confirm that `import JsonEditorVue from 'json-editor-vue'` is present at the top of your script. If using the Options API, ensure it's listed in the `components` option. For `<script setup>`, the import statement is sufficient for local registration.
Update your import statement to `import type { Mode } from 'vanilla-jsoneditor';` to correctly access the `Mode` type from its new location.