JSON Formatter

Paste raw or minified JSON to instantly beautify, validate, and explore it as a collapsible tree. Syntax errors are flagged with exact line and column numbers. Everything runs in your browser — your data never leaves your machine.

Indent
Sort keys A→Z
Tree view
Input · Raw JSON
Output · Formatted JSON
❤️ Support CodeConverter.net and donate ❤️

JSON formatting, validation & exploration

Why format and validate JSON?

JSON (JavaScript Object Notation) is the backbone of modern web APIs, configuration files, and data interchange. But raw API responses, minified bundles, and copy-pasted JSON from logs are often impossible to read at a glance. Formatting adds consistent indentation so the structure becomes immediately clear — nested objects and arrays are visually obvious, and issues like missing commas, unclosed brackets, or incorrect data types become easy to spot.

Validation goes a step further: it parses the JSON according to the RFC 8259 specification and reports the exact location of any syntax error. This is far more useful than a generic "parse error" in a console — knowing that the problem is on line 42, column 7 means you can fix it in seconds instead of hunting through hundreds of lines of minified output.

Beautify vs. minify
  • Beautify adds indentation for human readability
  • Minify strips all whitespace to reduce payload size
  • Both operations validate the JSON first
  • Use minify before sending JSON over a network API
Tree view explained
  • Objects and arrays are collapsible nodes
  • Values are colour-coded by type
  • Click any key or value to copy it directly
  • Expand / collapse all nodes with one click
How to use this tool
  • Paste JSON or upload a .json file
  • Choose indent style and optional key sorting
  • Click Format JSON or Minify
  • Toggle Tree View to explore the structure interactively
100% private & client-side
  • Uses native JSON.parse() — no server involved
  • Safe for API keys, tokens, and private data
  • No data is ever transmitted anywhere
  • Works offline after initial page load
Common JSON errors
  • Trailing commas after the last item in an array or object
  • Single-quoted strings — JSON requires double quotes
  • Comments (// … or /* … */) — not valid in JSON
  • Unescaped special characters inside string values
JSON data types
  • String — always double-quoted: "hello"
  • Number — integer or float: 42, 3.14
  • Boolean / nulltrue, false, null
  • Object / Array{} and [] for nesting

JSON vs. JSON5 vs. JSONC — which are you dealing with?

Standard JSON (RFC 8259) is strict: no comments, no trailing commas, no single-quoted strings. However, many real-world config files use relaxed variants. JSON5 (used by some build tools) allows comments, trailing commas, unquoted keys, and single quotes. JSONC (JSON with Comments, used by VS Code's settings.json) allows // and /* */ comments but is otherwise standard JSON.

This tool validates strict RFC 8259 JSON only. If your JSON contains comments or trailing commas, you'll need to strip those first before formatting. A quick approach: open the file in VS Code, save it as a .json extension, and use the built-in "Format Document" command which understands JSONC. Then paste the cleaned result here for further processing or export.