How to Format JSON and Check It for Parsing Errors
Paste JSON text, choose your indentation and optional output settings, then run the formatter to receive readable JSON or parsing details when the text is malformed.
What the JSON formatter does
JSON formatting turns valid JSON text into a more readable layout, which helps when you need to inspect nested objects, review a response, or prepare JSON for a handoff. The formatter also checks whether the text can be parsed as JSON. You can choose the indentation value, optionally sort object keys, or switch to compact output when spacing is not needed.
How to format and check JSON
-
Paste the JSON text into the input. The input is optional, so you can also leave it blank when you are not ready to submit JSON.
-
Choose an indentation value if the default of 2 spaces does not suit your workflow. A larger value can make nested data easier to scan, while a smaller value keeps the layout tighter.
-
Decide whether to enable key sorting. Sorting is off by default; when enabled, object keys are ordered in the formatted output. Use it when a consistent key order helps you compare or review objects.
-
Decide whether to enable compact output. This option is off by default. When enabled, the serialized JSON uses compact comma and colon separators instead of indentation.
-
Run the formatter and inspect the result. Valid JSON produces formatted JSON text. Unicode characters in valid JSON can remain in that formatted text, so names and other non-ASCII content do not need to be replaced merely because they use Unicode.
-
If the input is malformed, correct the JSON and run it again. Parsing failure reports that the input is invalid, retains the submitted text as returned content, and includes parsing error details. For blank or whitespace-only input, the operation succeeds without formatted content and indicates that no JSON input was provided.
How to read the result
A formatted result means the submitted text was parsed as JSON and serialized into a readable JSON form. It does not mean that the data matches a particular business schema, contains required fields, or passes rules outside JSON parsing and formatting.
If key sorting is enabled, a changed key order is expected in the formatted output. If compact output is enabled, the absence of indentation is also expected. These settings affect presentation rather than adding data to the JSON. If parsing fails, use the included details to locate the problem, then check punctuation, quotes, brackets, and nesting in the source text before trying again.
A blank result needs separate interpretation: blank or whitespace-only input is treated as a successful submission with no formatted content because no JSON input was provided. That is different from valid JSON whose formatted content happens to be short.
Worked example
You are reviewing a nested order response and want readable spacing before checking its contents.
Paste a JSON response containing a customer name and an order list, keep the default indentation, leave key sorting and compact output disabled, and run the formatter.
The result is either formatted JSON text when the submission parses successfully, or retained submitted text with parsing error details when it does not.
Limitations
- The tool checks JSON parsing and formats JSON text; it does not establish that the data follows a separate business schema or contains particular fields.
Common errors
- A missing quote, comma, or closing bracket can make JSON malformed. Correct the reported parsing issue in the submitted text, then run the formatter again.
FAQ
What happens if I leave the JSON input blank?
The input can be left blank because JSON text is optional. In that case, blank or whitespace-only input is treated as successful without formatted content and indicates that no JSON input was provided.
Can I change the JSON output layout?
You can adjust the indentation value, which defaults to 2. You can also enable key sorting or compact output when those presentation choices fit your task.
What happens when the JSON is invalid?
A malformed submission reports parsing failure, retains the submitted text as returned content, and includes parsing error details. Fix the JSON syntax and submit it again.