{"id":12514,"library":"vue-json-tree","title":"Vue JSON Tree","description":"vue-json-tree is a Vue 2 component designed to display JavaScript Object Notation (JSON) data in an interactive, collapsible tree structure. Currently at version 0.4.3, the package appears to have an irregular release cadence, indicative of a pre-1.0 project primarily maintained for existing Vue 2 applications. Its key differentiator lies in its straightforward integration within Vue 2 ecosystems, offering both string-based (`raw` prop) and pre-parsed object-based (`data` prop) input methods. This flexibility allows developers to easily visualize complex JSON structures, with options to control the initial expansion level. It focuses specifically on the display aspect, without editing capabilities, making it a lightweight solution for debugging or data inspection within Vue 2 applications.","status":"maintenance","version":"0.4.3","language":"javascript","source_language":"en","source_url":"https://github.com/myst729/vue-json-tree","tags":["javascript","vue","json","tree"],"install":[{"cmd":"npm install vue-json-tree","lang":"bash","label":"npm"},{"cmd":"yarn add vue-json-tree","lang":"bash","label":"yarn"},{"cmd":"pnpm add vue-json-tree","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency for the Vue.js component framework. Specifically designed for Vue 2.","package":"vue","optional":false}],"imports":[{"note":"Primary import for bundlers like Webpack/Vite in Vue 2 projects. Typically registered globally or locally.","wrong":"const JsonTree = require('vue-json-tree')","symbol":"JsonTree","correct":"import JsonTree from 'vue-json-tree'"},{"note":"After importing `JsonTree`, register it globally in your Vue 2 application. The `app.component` syntax is for Vue 3.","wrong":"app.component('json-tree', JsonTree)","symbol":"Global Component","correct":"Vue.component('json-tree', JsonTree)"},{"note":"Exposes `<json-tree>` component globally in the browser after Vue is loaded. Ensure the version in the URL matches your project's `vue-json-tree` version.","symbol":"Browser Global","correct":"<script src=\"https://unpkg.com/vue-json-tree@0.4.1/dist/json-tree.js\"></script>"}],"quickstart":{"code":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Vue JSON Tree Quickstart</title>\n  <style>\n    body { font-family: sans-serif; margin: 20px; }\n    #app { border: 1px solid #eee; padding: 15px; border-radius: 5px; max-width: 600px; margin-top: 20px; }\n  </style>\n</head>\n<body>\n  <h1>Vue JSON Tree Demonstration</h1>\n  <p>This example showcases the <code>vue-json-tree</code> component rendering a complex JSON object.</p>\n  <div id=\"app\"></div>\n\n  <!-- Include Vue 2 -->\n  <script src=\"https://unpkg.com/vue@2.6.14/dist/vue.min.js\"></script>\n  <!-- Include vue-json-tree -->\n  <script src=\"https://unpkg.com/vue-json-tree@0.4.1/dist/json-tree.js\"></script>\n\n  <script>\n    new Vue({\n      template: `\n        <div>\n          <h2>Product Catalog Data</h2>\n          <json-tree :raw=\"catalogData\" :level=\"1\"></json-tree>\n          <hr>\n          <h2>User Profile Data</h2>\n          <json-tree :data=\"userData\"></json-tree>\n        </div>\n      `,\n      el: '#app',\n      data: {\n        catalogData: JSON.stringify({\n          products: [\n            {\n              id: \"P001\",\n              name: \"Laptop Pro X15\",\n              category: \"Electronics\",\n              price: 1200.00,\n              features: [\"16GB RAM\", \"512GB SSD\", \"Intel i7\"],\n              available: true,\n              manufacturer: {\n                name: \"TechCorp\",\n                country: \"USA\"\n              },\n              reviews: [\n                { user: \"Alice\", rating: 5, comment: \"Fantastic machine!\" },\n                { user: \"Bob\", rating: 4, comment: \"Good, but a bit pricey.\" }\n              ]\n            },\n            {\n              id: \"P002\",\n              name: \"Wireless Earbuds\",\n              category: \"Accessories\",\n              price: 89.99,\n              features: [\"Bluetooth 5.0\", \"Noise Cancelling\"],\n              available: false,\n              manufacturer: {\n                name: \"AudioTech\",\n                country: \"China\"\n              }\n            }\n          ],\n          lastUpdated: new Date().toISOString()\n        }, null, 2),\n        userData: {\n          username: \"developer_user\",\n          email: \"dev@example.com\",\n          roles: [\"admin\", \"editor\"],\n          settings: {\n            theme: \"dark\",\n            notifications: {\n              email: true,\n              push: false\n            }\n          },\n          lastActivity: new Date().toISOString(),\n          preferences: {\n            language: \"en-US\",\n            timezone: \"UTC\"\n          }\n        }\n      }\n    });\n  </script>\n</body>\n</html>\n","lang":"html","description":"This quickstart demonstrates how to integrate and use `vue-json-tree` within a Vue 2 application using browser script tags, showcasing both `raw` (JSON string) and `data` (parsed object) props, along with initial collapse level for nested data."},"warnings":[{"fix":"Ensure your project uses Vue 2.x. For Vue 3, seek alternative JSON tree view components designed for Vue 3.","message":"vue-json-tree is built specifically for Vue 2. It is not compatible with Vue 3 due to breaking API changes in Vue's component system and reactivity model.","severity":"breaking","affected_versions":"all"},{"fix":"Always ensure the value passed to the `raw` prop is a `JSON.stringify()`'d object or a manually verified valid JSON string.","message":"The `raw` prop expects a valid JSON string. If the string is malformed, the component will fail to render the data and may throw a parsing error.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `raw` if your data source is a string, or `data` if it's already a JavaScript object. Do not pass an object to `raw` or a string to `data`.","message":"Choose between the `raw` prop (for JSON strings) and the `data` prop (for pre-parsed JavaScript objects). Providing incorrect types or attempting to use both simultaneously can lead to unexpected rendering issues or errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Validate your JSON string before passing it to the `raw` prop. Use a JSON linter or `JSON.parse` in a try-catch block to debug invalid data.","cause":"The string passed to the `raw` prop is not valid JSON and cannot be parsed.","error":"JSON.parse: unexpected character at line 1 column X of the JSON data"},{"fix":"For Vue 2, ensure `Vue.component('json-tree', JsonTree)` is called globally, or import and register it locally within your component's `components` option. If using Vue 3, this component is incompatible; find a Vue 3-native alternative.","cause":"The `json-tree` component was not registered with your Vue instance, or you are trying to use it in a Vue 3 application without a compatibility layer.","error":"[Vue warn]: Unknown custom element: <json-tree> - did you register the component correctly?"}],"ecosystem":"npm"}