Skip to content

JSON Formatter / Validator

Format, validate, minify, and pretty-print JSON data instantly.

Input

Drop file here or click to browse

Maximum 20 MB (.json,.txt)

Output will appear here.

About the JSON Formatter / Validator

This free JSON formatter takes minified, escaped, or badly indented JSON and turns it into clean, readable output in one click. Paste an API response, a config file, or a log line and the validator immediately reports the exact line and column of any syntax error, so you can fix malformed JSON without guessing where the missing comma is.

How to use it

  1. 1 Paste your JSON into the input box, or drop a .json file onto the drop zone.
  2. 2 Click Format to pretty-print, Minify to strip whitespace, or Sort keys to order every object alphabetically before a diff.
  3. 3 If the JSON is invalid, the error names the exact line and column — click Auto-repair to fix trailing commas, single quotes, unquoted keys and comments in one step.
  4. 4 Switch to the Tree tab to explore the structure and click any key to copy its path.
  5. 5 Use the Query tab to pull out just the values you need with a JSONPath expression.

What it does

  • Pretty-print, minify, or sort every object key alphabetically
  • Validate with precise line and column error reporting
  • Auto-repair trailing commas, single quotes, unquoted keys and comments
  • Collapsible tree view — click any key to copy its path
  • JSONPath query with wildcards, slices and recursive descent
  • Document statistics: node count, nesting depth, type breakdown
  • Drag-and-drop upload for files up to 20 MB

Frequently asked questions

Is my JSON data sent to a server?

No. Every calculation happens locally in your browser using JavaScript. Nothing you paste is uploaded, logged, or stored on a server, which makes the tool safe to use with production data, credentials, and customer records.

Why does my JSON say "Unexpected token"?

That error almost always means one of four things: a trailing comma after the last item in an object or array, single quotes used instead of double quotes, an unquoted property name, or an unescaped character inside a string. JSON is stricter than JavaScript object literals — comments and trailing commas are never allowed.

What is the difference between formatting and minifying JSON?

Formatting adds newlines and indentation so a human can read the structure. Minifying removes every optional space and newline to make the payload as small as possible for network transfer. Both produce the same data — only the whitespace differs.

Can it handle very large JSON files?

Yes. Because parsing runs in your browser there is no upload limit or request timeout. Files in the tens of megabytes work fine on a modern machine; the practical ceiling is your available memory rather than any server-side cap.

Does it support JSON with comments (JSONC) or trailing commas?

The validator follows the strict JSON specification, so comments and trailing commas are reported as errors — that is intentional, because they would fail in a production parser even though your editor tolerates them. Auto-repair then strips them for you in one click.

What can the auto-repair fix?

Trailing commas, single-quoted strings, unquoted object keys, // and /* */ comments, Python-style True/False/None, and NaN or Infinity literals. It works as a character scanner rather than a set of regexes, so text inside your string values is never rewritten. It cannot invent missing brackets, so a truncated document still has to be fixed by hand.

What JSONPath syntax does the query tab support?

Dotted keys ($.store.name), bracket keys ($['store']), array indices including negative ones ([-1]), wildcards ([*]), slices ([1:3]), and recursive descent (..name) to find a key at any depth. Filter expressions such as [?(@.price>10)] are not supported.