Back to guides
Developer guide3 min read·Published May 21, 2026·Updated August 14, 2026

By DevToolKit

How to Format JSON Online

Use automatic JSON.parse and JSON.stringify formatting, inspect strict-JSON parser errors, and review indented text up to 1,000,000 characters.

1

What automatic JSON formatting does

JSON Formatter starts processing as soon as the input or indentation setting changes. It passes the textarea content to JSON.parse. When parsing succeeds, JSON.stringify serializes the parsed value with the selected indentation, producing readable output for objects, arrays, strings, numbers, booleans, or null.

This is syntax validation, not schema validation. A payload can be valid JSON while containing an unexpected property, a number where an application expects a string, or a value that violates a business rule. The formatter does not load JSON Schema, compare an API model, or decide whether the data is suitable for a particular system.

2

Minified input and 2-space output

Valid minified input: {"service":"orders","enabled":true,"retries":3,"regions":["eu","us"]}

With 2-space indentation, the formatted output is shown here with ↵ for each line break and · for each space: { ↵ ··"service": "orders", ↵ ··"enabled": true, ↵ ··"retries": 3, ↵ ··"regions": [ ↵ ····"eu", ↵ ····"us" ↵ ··] ↵ }

The output adds whitespace and line breaks for inspection; it does not create new properties or evaluate the values against an application contract. Changing the Indent control to 4 or 8 spaces regenerates the readable output automatically from the parsed value.

3

Use the automatic formatter

Paste JSON text into the input area and wait for the current parse result. There is no Format button: input changes trigger parsing, validation, and pretty-printing, and an indentation change triggers serialization again.

Choose 2, 4, or 8 spaces with the Indent control. A successful parse displays formatted output; a failed parse leaves no formatted result and shows the error message supplied by the browser's JSON parser.

The component accepts textarea text only. To use a saved .json file, open it in an editor or viewer and paste its text. There is no file picker or file-upload control, and the formatting operation does not submit the pasted JSON to a conversion server.

4

Fix strict-JSON syntax errors

Remove a trailing comma after the final property or array item. Replace single-quoted keys and strings with double-quoted JSON strings, and put double quotes around every object key. JavaScript object-literal conveniences are not automatically accepted as JSON.

Remove // line comments and /* block comments */ because JSON.parse does not accept comments. Check string escapes as well: an unsupported backslash sequence, an unescaped newline, or a quote that closes a string too early prevents parsing.

Complete every opening object brace and array bracket, and verify the separators between values. The browser parser message is displayed as available, but the component does not add a guaranteed line-and-column diagnostic interface. Correct the source and let the automatic result update again.

5

Know the processing boundary

Input is limited to 1,000,000 characters. Once the textarea exceeds that limit, the component reports a size error and does not pass the content to JSON.parse. Trim a large log to the relevant object or use an appropriate local development tool for a larger dataset.

JSON Formatter produces pretty-printed output only. It has no minified-output mode, key-sorting option, copy button, download action, file input, or file upload. If you need the result elsewhere, select the displayed text manually and keep any destination's handling rules in mind.

Object property order is not a schema check, and formatting does not compare two payloads. Review the values and structure yourself before placing the result in configuration, documentation, or a request body.

6

Keep related debugging tasks separate

Use Text Diff when you need a positional comparison between two formatted versions; the formatter itself does not compare documents. Use JWT Decoder to inspect a token's decoded header and payload, remembering that decoding does not verify its signature.

If a JSON string contains Base64-encoded text, decode that text separately before deciding whether it contains another JSON document. Sensitive-data redaction, clipboard exposure, and screen-sharing precautions belong in the dedicated redaction and review guide rather than this operational formatting workflow.

Related reading

Continue with these guides

Closely related workflows with a different focus from this article.

Related tools

Try these DevToolKit tools

Workflows mentioned in this guide that exist in the current catalog.

View all tools