JSON Editor
Edit, format, and validate JSON with syntax highlighting and real-time error detection — powered by Ace Editor, fully in-browser.
What is JSON editing?
JSON is a data language: double-quoted strings, no comments, no trailing commas, no undefined. An editor with a JSON mode highlights those tokens and can parse on each change. Formatting is a separate pretty-print step; validation is parse success or failure. See the RFC 8259.
The workspace is a single Ace editor (Monokai, JSON mode, gutter fold widgets) plus a sidebar. Sample loads a John Doe object with nested address and a hobbies array. Typing runs JSON.parse; Status shows ✓ Valid or ✗ Invalid with the engine message (no line/column — JSON Formatter reports those). Format pretty-prints with JSON.stringify(value, null, 2). Minify is JSON.stringify(value) with no space. Both refuse invalid JSON and set “Cannot format invalid JSON” / “Cannot minify invalid JSON”. Fold offers Collapse Current, Expand Current, Collapse All, Expand All, and L1/L2/L3 (foldToLevel). Copy copies the buffer; it does not download a .json file. The editor loads on the client only (dynamic import, no SSR) to avoid Ace hydration issues. Ace’s JSON worker is served from this origin under /ace/worker-json.js. For a collapsible data tree, sorted keys, and errors with line and column, use JSON Formatter — this page is an editor, not a tree view.
When to use this tool
- Edit a payload — Paste a response, change a field, Format, Copy. Nested objects can be folded with L1–L3 so the file is scannable.
- Catch a trailing comma — Status flips to Invalid as soon as JSON.parse throws. The message is the native SyntaxError text.
- Minify before paste — Minify removes whitespace for a compact body. Data is unchanged.
- Need a tree or .json download — JSON Formatter builds a collapsible tree, can sort keys, and downloads output.json. Fold here only hides Ace ranges. JSON Formatter
How to use the JSON Editor
Wait for Ace, then edit
The panel shows “Loading editor…” until the client bundle and JSON worker are ready. Sample is already in the buffer.
Watch Status
Valid JSON shows ✓ Valid. Invalid JSON shows ✗ Invalid and the parse error under Status. Empty input is treated as valid (“—”).
Format, Minify, or Fold
Format uses 2-space indent. Minify is a single line. Collapse All / L1–L3 fold nested objects. Copy copies the current text.
Keyboard
Ctrl/⌘+Z undo, Ctrl/⌘+Y redo, Ctrl/⌘+F find, Ctrl/⌘+H replace, Ctrl/⌘+A select all — Ace defaults.
Worked examples
Format a compact object
{"name":"Alice","age":30,"active":true}{
"name": "Alice",
"age": 30,
"active": true
}Matches JSON.stringify(JSON.parse(input), null, 2).
Minify the Sample-shaped object
{
"name": "John Doe",
"age": 30,
"active": true
}{"name":"John Doe","age":30,"active":true}Trailing comma is invalid JSON
{"name": "Alice",}✗ Invalid — JSON.parse throws (Status shows the engine message).
Tips
- Single-quoted strings and unquoted keys fail JSON.parse.
- undefined is not JSON — use null.
- The worker URL is same-origin /ace/worker-json.js so CSP worker-src 'self' stays intact.
Frequently Asked Questions
Is my JSON data sent anywhere?
No. Ace and JSON.parse run in the browser. Nothing is transmitted or stored on a server.
What is the difference between Format and Minify?
Format adds 2-space indentation and newlines. Minify removes whitespace. Both keep the same data. Invalid JSON cannot be formatted or minified.
Does this editor have a tree view?
No. Folding hides ranges inside Ace. A dedicated collapsible tree, key sorting, line/column errors, and .json download are on JSON Formatter.
Can JSON have comments?
Standard JSON (RFC 8259) does not allow comments or trailing commas. JSONC/JSON5 are different languages; this page parses strict JSON.
Can I edit large files?
Ace virtualizes the viewport. Multi-megabyte buffers are possible; fold nested sections if scrolling gets heavy. There is no file-size cap in the UI.