A keyboard-first JSON editor with optional JSON Schema validation, designed for developers who want to edit JSON efficiently.
Include the editor in your project using ES modules directly from the CDN:
Basic Editor (no schema)
<!DOCTYPE html>
<html>
<head>
<style>
json-editor { height: 400px; display: block; }
</style>
</head>
<body>
<json-editor></json-editor>
<script type="module">
import 'https://json-editor.devblanket.com/src/components/json-editor.js';
const editor = document.querySelector('json-editor');
editor.setValue({ hello: 'world' });
</script>
</body>
</html>
Full IDE with Schema Panel
<!DOCTYPE html>
<html>
<head>
<style>
json-editor-schematic { height: 100vh; display: block; }
</style>
</head>
<body>
<json-editor-schematic padding-top="8" padding-left="12"></json-editor-schematic>
<script type="module">
import 'https://json-editor.devblanket.com/src/components/json-editor-schematic.js';
const editor = document.querySelector('json-editor-schematic');
editor.load({
name: 'User Profile',
document: {
name: 'Jane Doe',
email: 'jane@example.com',
age: 28
},
schema: {
type: 'object',
properties: {
name: { type: 'string' },
email: { type: 'string', format: 'email' },
age: { type: 'integer', minimum: 0 }
},
required: ['name', 'email']
}
});
</script>
</body>
</html>
| Component | Import Path | Description |
|---|---|---|
json-editor |
/src/components/json-editor.js |
Basic JSON editor without schema |
json-editor-schema-wrapper |
/src/components/json-editor-schema-wrapper.js |
JSON editor with schema validation |
json-editor-schematic |
/src/components/json-editor-schematic.js |
Full IDE with data + schema panels |
All editor components support these attributes:
| Attribute | Type | Description |
|---|---|---|
padding-top |
number | Top padding in pixels for the tree content |
padding-left |
number | Left padding in pixels for the tree content |
<json-editor padding-top="8" padding-left="12"></json-editor>
The editor uses a cursor-based navigation model. One node is always focused (highlighted with a colored border).
| Key | Action |
|---|---|
↑ or k |
Move cursor up |
↓ or j |
Move cursor down |
← or h |
Fold current node (collapse children) |
→ or l |
Unfold current node (expand children) |
[ |
Go back to parent node |
Ctrl+↑ |
Move item up in array |
Ctrl+↓ |
Move item down in array |
Objects and arrays can be folded (collapsed) to hide their contents:
← or h to fold the current container→ or l to unfoldobject 3 properties or array 5 items| Key | Action |
|---|---|
Space |
Edit the current value |
- |
Auto-edit mode — edit with smart type inference |
Shift+Space |
Open info panel for current node |
Enter |
Add a sibling after current node |
Shift+Enter |
Add a sibling before current node |
Ctrl+Enter |
Add a child to current container |
r |
Rename the current key |
, |
Open type selector menu |
The - key is one of the most useful shortcuts. It opens an "auto-edit" mode that:
name: value to create a new property{} or [] to create objects/arraysThis is the recommended way to edit values when you're not sure of the exact type, or when you want to quickly create new properties.
These keys instantly change the current value:
| Key | Action |
|---|---|
t |
Set value to true |
f |
Set value to false |
, |
Open type selector menu |
- |
Switch to auto-edit mode |
{ |
Convert to empty object {} |
[ |
Convert to empty array [] |
When editing a value:
| Key | Action |
|---|---|
Enter |
Commit the edit |
Escape |
Cancel the edit |
Tab |
Accept autocomplete suggestion (if shown) |
↑/↓ |
Navigate autocomplete suggestions |
The editor intelligently parses your input:
| You type | Result |
|---|---|
hello |
"hello" (string) |
42 |
42 (number) |
3.14 |
3.14 (number) |
true / false |
boolean |
null |
null |
"quoted" |
"quoted" (explicit string) |
[1, 2, 3] |
array (parsed as JSON) |
{a: 1} |
object (relaxed JSON syntax) |
When adding properties to objects, use the colon syntax:
name: John
This creates a property "name" with value "John".
For nested creation:
user: {name: Alice, age: 30}
When adding items to arrays, you can use bullet syntax:
* first item
* second item
Or just type the value directly.
| Key | Action |
|---|---|
Shift+↑ |
Extend selection upward |
Shift+↓ |
Extend selection downward |
Cmd/Ctrl+A |
Select all nodes |
| Key | Action |
|---|---|
Cmd/Ctrl+C |
Copy selected nodes |
Cmd/Ctrl+X |
Cut selected nodes |
Cmd/Ctrl+V |
Paste |
Backspace or Delete |
Delete selected nodes |
| Key | Action |
|---|---|
Cmd/Ctrl+Z |
Undo |
Cmd/Ctrl+Y or Cmd/Ctrl+Shift+Z |
Redo |
z |
Undo (vim style) |
Z |
Redo (vim style) |
The editor maintains a full history of changes. Each atomic operation (add, delete, edit) creates a snapshot.
| Key | Action |
|---|---|
. |
Toggle status bar visibility |
J |
Scroll view down (keep cursor) |
K |
Scroll view up (keep cursor) |
Press ` (backtick) to open the command palette. Available commands:
| Command | Description |
|---|---|
fold-all |
Collapse all nodes |
unfold-all |
Expand all nodes |
fold-level-1 |
Collapse to depth 1 |
fold-level-2 |
Collapse to depth 2 |
fold-level-3 |
Collapse to depth 3 |
select-all |
Select all nodes |
help |
Show keyboard shortcuts |
Press / to start a search. Type your query and:
| Key | Action |
|---|---|
Enter |
Go to first match |
n |
Next match |
N (Shift+n) |
Previous match |
Escape |
Clear search |
Search matches are highlighted in the tree.
Press $ to open path navigation. Type a JSON path:
$.users[0].name
users.0.name
The editor autocompletes paths as you type. Press Tab to accept a suggestion.
Press Shift+Space to open the info panel for the current node. The info panel shows:
Press Cmd/Ctrl+Shift+M to open the marks panel. This shows all validation errors and warnings in the document.
Click on a mark to navigate to that node.
When using json-editor-schema-wrapper or json-editor-schematic, the editor validates your data against a JSON Schema.
With a schema loaded:
The json-editor-schematic component provides a full IDE experience with:
| Action | Description |
|---|---|
| Drag the divider | Resize panels |
| Double-click divider | Reset to 50/50 |
const schematic = document.querySelector('json-editor-schematic');
// Load data and schema together
schematic.load({
name: 'My Document',
document: { hello: 'world' },
schema: { type: 'object', properties: { hello: { type: 'string' } } }
});
// Get current state
const doc = schematic.getDocument();
const schema = schematic.getSchema();
// Infer schema from data
schematic.inferSchema();
// Generate sample data from schema
schematic.generateSample();
// Download files
schematic.download(); // Both as ZIP
schematic.downloadDocument(); // Just data
schematic.downloadSchema(); // Just schema
Basic editor for JSON data without schema validation.
const editor = document.querySelector('json-editor');
// Get/set the document
editor.setValue({ key: 'value' });
const data = editor.getValue();
// Cursor control
editor.setCursorPath(['users', 0, 'name']);
const path = editor.getCursorPath();
// Undo/redo
editor.undo();
editor.redo();
// Marks (annotations)
editor.setMark(['path', 'to', 'node'], {
status: 'error',
message: 'Invalid value'
});
editor.removeMark(['path', 'to', 'node']);
editor.clearAllMarks();
// State persistence
const state = editor.getState(); // Includes folds, cursor, etc.
editor.setState(state);
// Focus
editor.focus();
Editor with JSON Schema validation.
const editor = document.querySelector('json-editor-schema-wrapper');
// All json-editor methods, plus:
// Load a schema
editor.loadSchema({
type: 'object',
properties: {
name: { type: 'string' }
},
required: ['name']
});
// Get current schema
const schema = editor.getSchema();
// Clear schema (disable validation)
editor.clearSchema();
// Manually trigger validation
editor.validate();
// Infer schema from current data
const inferredSchema = editor.inferSchema();
// Get schema-aware completions
const completions = editor.getCompletions(['path']);
Full IDE with data and schema panels.
const schematic = document.querySelector('json-editor-schematic');
// Load everything at once
schematic.load({
name: 'Config',
document: { port: 3000 },
schema: { type: 'object', properties: { port: { type: 'integer' } } }
});
// Individual getters/setters
schematic.setDocument({ port: 8080 });
schematic.setSchema({ type: 'object' });
schematic.setName('New Name');
const doc = schematic.getDocument();
const schema = schematic.getSchema();
// Layout control
schematic.splitHorizontal(); // Show both panels
schematic.showSingle('data'); // Show only data
schematic.showSingle('schema'); // Show only schema
// Focus control
schematic.focus(); // Focus the component
schematic.focusData(); // Focus data panel
schematic.focusSchema(); // Focus schema panel
// Navigate to a path
schematic.goToPath('data', ['users', 0]);
schematic.goToPath('schema', ['properties', 'users']);
// Schema operations
schematic.inferSchema(); // Infer schema from data
schematic.generateSample(); // Generate data from schema
// File operations
schematic.download(); // Download as ZIP
schematic.downloadDocument(); // Download data.json
schematic.downloadSchema(); // Download schema.json
schematic.openFile(); // Open file dialog
All editors emit these events:
| Event | Detail | Description |
|---|---|---|
document:change |
{ document } |
Document was modified |
document:replace |
{ document } |
Document was completely replaced |
cursor:move |
{ path } |
Cursor moved to new path |
state:change |
{ key, value } |
Editor state changed |
json-editor-schematic also emits:
| Event | Detail | Description |
|---|---|---|
document-change |
{ document } |
Data panel document changed |
schema-change |
{ schema } |
Schema was modified |
cursor-change |
{ panel, path } |
Cursor moved in either panel |
editor.addEventListener('document:change', (e) => {
console.log('Document changed:', e.detail.document);
});
The editor uses CSS custom properties for theming. Override these on the component or a parent:
json-editor {
/* Colors */
--color-bg: #1a1a1a;
--color-fg: #e0e0e0;
--color-string: #a8d08d;
--color-number: #d4a656;
--color-boolean: #6eb5ff;
--color-null: #888888;
/* Spacing */
--tree-padding-top: 8px;
--tree-padding-left: 12px;
}
name: value is faster than adding then editingt, f, n for booleans and null← to collapse subtrees you're not editingShift+Space shows what the schema expects$ and type the path directly/ to find values quicklyCmd+Shift+M to see all issues at onceThe editor uses modern web standards:
Supported browsers:
Copyright (c) 2026 DevBlanket
Permission is granted to use this software via the official CDN (json-editor.devblanket.com) for any purpose, including commercial use.
You may NOT:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.