Registry / devops / json-schema-view-js

json-schema-view-js

JSON →
library2.0.1jsnpmunverified

A pure JavaScript library for rendering JSON Schema objects as readable HTML. Version 2.0.1 provides a simple API to visualize any JSON schema in a collapsible tree view, with options to control expansion depth and themes. It is lightweight, has no dependencies, and is designed for embedding in web pages. The library exposes a single global constructor and is also available as an AngularJS directive. Primary use case is debugging and displaying schema structures in a user-friendly format.

npm install json-schema-view-js
INSTALL
IMPORT
SIG · JSON-SCHEMA-VIEW-J
J
json-schema-view-js
devopsjavascriptv2.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JSONSchemaView
import JSONSchemaView from 'json-schema-view-js'
const JSONSchemaView = require('json-schema-view-js')
The package is ESM-only; commonJS require may not work. Use default import.
JSONSchemaView
<script src="bower_components/json-schema-view-js/dist/json-schema-view-js.js"></script>
None
In browsers, use the global constructor after including the script.

Creates a JSONSchemaView instance from a schema object and appends the rendered tree to the document body.

import JSONSchemaView from 'json-schema-view-js'; const schema = { type: 'object', properties: { name: { type: 'string', title: 'Name' }, age: { type: 'number', description: 'Age in years' } }, required: ['name'] }; const view = new JSONSchemaView(schema, 2); document.body.appendChild(view.render());
Debug
Known issues
deprecatedPackage is no longer actively maintained; last release 2.0.1 in 2020.
fix
Consider forking or using alternatives like react-jsonschema-viewer if active maintenance is needed.
affects: >=2.0.0
gotchaThe `open` parameter affects initial expansion depth; default is 1. Setting to 0 collapses all levels.
fix
Explicitly pass desired depth to avoid unexpected full collapse.
affects: >=1.0.0
gotchaThe library does not validate the schema; it only renders the structure.
fix
Use a schema validator like Ajv before rendering if validation is needed.
affects: all
Errors
Common errors & fixes
Uncaught TypeError: JSONSchemaView is not a constructor
Incorrect import syntax or missing script tag.
fix
Use default import `import JSONSchemaView from 'json-schema-view-js'` or include the script via <script> tag that exposes the global.
Cannot find module 'json-schema-view-js'
Package not installed or not in node_modules.
fix
Run `npm install json-schema-view-js` or install via bower as documented.
TypeError: view.render is not a function
The view object is not properly created; schema argument may be invalid.
fix
Ensure schema is a valid object and not undefined/null.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
json-schema-view-js — npm install json-schema-view-js · libregistry