Get online today — Domain + Hosting at discounted prices View Combo Offers ›

JSON Formatter & Validator

Format, validate and minify JSON with precise error locations.

Paste JSON to reformat it with consistent indentation, validate it against the JSON specification, or strip it down to the smallest valid form. If the document is invalid, you get the exact line and column of the problem along with what the parser expected — rather than a bare "syntax error".

Formatting runs on our server and the result is returned in the same request. Nothing is stored: your JSON is never written to disk, never logged, and never shared with a third-party service.

How it works

The tool parses your input with PHP's JSON parser in strict mode, which follows RFC 8259. Valid documents are re-encoded with your chosen indentation, and the structure is walked to report depth, key count and array sizes — useful for spotting an unexpectedly deep nest or a payload far larger than you assumed.

Invalid documents are scanned to convert the parser's byte offset into a human line and column, and a short excerpt around the failure is shown so you can see the problem in context. The most common causes are trailing commas, single quotes instead of double quotes, unescaped control characters inside strings, and unquoted object keys — all of which JavaScript tolerates in object literals but JSON does not.

Frequently asked questions

Is my JSON uploaded or stored anywhere?

No. Your input is processed in the request and discarded when the response is sent. It is not written to disk, not saved in logs, and not sent to any third party.

Why does my JSON fail when it works in JavaScript?

JavaScript object literals are more permissive than JSON. JSON forbids trailing commas, requires double quotes on both keys and string values, disallows comments, and does not accept NaN or Infinity. Any of these will parse in JS but fail strict JSON validation.

What is the maximum size I can format?

Two megabytes per request. Larger documents are better handled by a streaming parser locally, since browsers struggle to render very large formatted output anyway.

What does the depth statistic mean?

How many levels of nested objects or arrays the document contains. Very deep structures can hit parser limits in other languages and often indicate data that would be easier to work with flattened.

Does it preserve the order of object keys?

Yes. Keys are emitted in the order they appear in your input; the tool never reorders or sorts them unless you ask it to.

Can it handle JSON Lines or NDJSON?

Not directly — those formats put one JSON document per line, which is not itself valid JSON. Format a single line at a time, or wrap the lines in an array first.

Related tools

Need hosting that just works?

Free SSL, daily backups and 24×7 support on every Loudhost plan.

View Hosting Plans