JSON Formatter
The JSON formatter parses a JSON string and outputs it in a readable, indented form with syntax highlighting, or validates it and reports the exact line and column of any syntax error.
Input
Output
How to use
• Format & Validate: beautify and validate JSON, pinpointing the failing line/column.
• Minify: strip whitespace to produce compact JSON.
• Sort keys: recursively sort object keys ascending / descending (duplicate keys are de-duped).
• Tree view: collapse / expand the structure; click a node to drop its JSONPath into the query box.
• JSONPath query: extract nodes with an expression, e.g. $.items[*].name.
• Escape / Unescape: convert between raw text and JSON string-escaped form.
• Text ↔ Unicode: convert between non-ASCII text and \uXXXX escapes.
• To GET params: turn a JSON object into a query string.
• Memory: when on, your last input is saved to local storage.
Related tools
What the JSON formatter is for
The JSON formatter parses a JSON string and outputs it in a readable, indented form with syntax highlighting, or validates it and reports the exact line and column of any syntax error. It also supports minifying (stripping all whitespace), recursively sorting keys, escaping and unescaping string content, converting between Unicode escape sequences and readable text, converting a JSON object to GET query parameters, and extracting nodes with JSONPath expressions.
Common uses include beautifying API responses for inspection, minifying JSON for production payloads, sorting keys to produce consistent diffs in version control, extracting specific fields from large JSON objects with JSONPath, and diagnosing malformed JSON from logs or third-party APIs.
Frequently asked questions
Why does formatting fail with an error?
The input is not valid JSON. The error message includes the line and column number of the first syntax problem — common issues are trailing commas, single-quoted strings, unquoted keys, or comments (none of which are valid JSON).
Does formatting always preserve the original JSON values?
Not always. This tool parses and serializes JSON in JavaScript. Duplicate keys can collapse, integers beyond the safe range can lose precision, and number notation can change. Preserve the original and verify important data.
Does sorting keys change the data?
Object key order is not semantically significant in JSON, but parsing and serializing can still change duplicate keys or numeric precision. Sorting alone is not a general canonicalization protocol for signatures; preserve the original and verify important values.
Is the data sent to a server?
No. All formatting, validation, and transformation run entirely in your browser. Your JSON is never uploaded anywhere.
References and result limitations
Local results depend on the input and selected options. Retain the input example, format and processing rules when citing a result, and verify the output. Keep keys and other sensitive material out of public examples.
These references explain protocol or format rules; they do not endorse results produced by this site.