JSON Formatter
Input
Output
Your result appears here.
Press Format or Ctrl+Enter in the input.
Free online JSON formatter, validator & converter
Format, validate, repair and minify JSON — then explore it as a tree, convert it to YAML, XML, CSV or TypeScript, compare two documents or query it with JSONPath. Everything runs in your browser; nothing is uploaded.
How to use the JSON FormatterShow guide ▾Hide guide ▴
1. Get JSON in
Paste or type into the input, drag a file onto it, use Open file, or Load URL. It's validated as you type — errors are underlined with their line and column.
2. Format & fix
Format (or Ctrl+Enter) beautifies with your chosen indent; Minify compacts; Sort keys orders keys A→Z; Repair fixes common mistakes.
3. Explore & transform
Switch the output to Tree to browse — click a key to copy its path. Use Convert for YAML, XML, CSV, TypeScript or JSON Schema, Compare to diff two documents, or JSONPath Query to pull out values.
4. Take it with you
Copy or Download any result, or send it back to the input. Inside the editors: Ctrl+F searches, gutter arrows fold blocks. Your input autosaves in this browser.
JSON cheat sheet
JSON (JavaScript Object Notation, RFC 8259) has six value types and a few strict rules.
Data types
- String
"hello", "line\nbreak", "\u00e9"Double quotes only; escape \" \\ \n \t \uXXXX - Number
42, -3.14, 6.02e23No leading zeros, no hex, no NaN/Infinity - Boolean
true, falseLowercase - Null
nullLowercase; there is no undefined - Object
{ "name": "Ada", "age": 36 }Keys must be double-quoted strings - Array
[1, "two", { "three": 3 }]Items can be any type, separated by commas
Common errors & fixes
- Trailing comma
✕ { "a": 1, }✓ { "a": 1 } - Single quotes
✕ { 'a': 'b' }✓ { "a": "b" } - Unquoted key
✕ { a: 1 }✓ { "a": 1 } - Comments
✕ { "a": 1 // note }✓ { "a": 1 } - Python / JS literals
✕ { "ok": True, "x": undefined }✓ { "ok": true, "x": null } - Missing comma
✕ { "a": 1 "b": 2 }✓ { "a": 1, "b": 2 } - Raw line break in a string
✕ "line one line two"✓ "line one\nline two" - Leading zero
✕ { "zip": 02134 }✓ { "zip": "02134" }
More: JSON in JavaScript · JSON in Python · Browser support
FAQ
›Is my JSON sent to a server?
No. Formatting, validation, conversion and comparison all run in your browser. Your input is only saved in this browser's local storage so it's still there when you come back; loading from a URL fetches that URL directly from your browser.
›What does Repair fix?
Comments, trailing commas, single-quoted strings, unquoted keys, smart quotes, Python-style True/False/None, and missing commas between lines. Always check the repaired result.
›How big a file can it handle?
Several megabytes comfortably; files up to 50 MB can be opened. Very large documents are faster in Code view than Tree view.
›What JSONPath syntax is supported?
Root $, child .key and ['key'], indexes [0] and [-1], wildcards [*] and .*, recursive descent ..key, slices [0:3], unions [0,2], and filters like [?(@.price < 10)], [?(@.tag)] and [?(@.name =~ /^A/i)].
›Can I convert JSON to CSV?
Yes — arrays of objects become rows; nested objects are flattened into dot.path columns, and arrays of values are joined with semicolons.