Developer Tools

JSON Formatter

Paste a JSON response or configuration file to make its structure easier to inspect. Format with spaces or tabs, sort object keys, or remove unnecessary whitespace without rounding numeric values.

Free online tool

Loading tool…

Valid JSON. Number tokens and string escapes are preserved exactly.

Runs in your browser. Supports strict JSON up to 2 million characters and 128 nesting levels. Comments and trailing commas are invalid.

Formatting runs locally in your browser. This tool does not upload or store your pasted JSON.

GET STARTED

How to use the JSON Formatter

  1. 01

    Paste strict JSON into the input. The output updates as you edit.

  2. 02

    Choose two spaces, four spaces, tabs, or Minify. Enable key sorting if a consistent property order helps your review.

  3. 03

    Read any syntax error below the editor, then copy the valid output or download a .json file.

Examples

Preserve a long identifier

The token 90071992547409931234 stays exactly 90071992547409931234. The formatter changes whitespace directly on a parsed token tree rather than converting the value to a JavaScript number.

Inspect a nested response

An input such as {"user":{"name":"Ada"},"roles":["reader","writer"]} expands into indented objects and arrays. Minify produces a compact single-line version.

Formatting without changing number tokens

Number spelling, exponent notation, string escapes, and property order are preserved unless you enable key sorting. For example, 1.2300e+4 keeps its original spelling. Sorting uses case-sensitive string order recursively and does not sort arrays.

Find the first syntax error

Errors identify the line, column, and character position at which the parser first finds invalid input. Positions are one-based; characters are counted as JavaScript UTF-16 code units. Unquoted keys, comments, single-quoted strings, trailing commas, and undefined are not valid JSON.

Duplicate property names

This formatter preserves duplicate object properties and displays a warning. Other JSON software may keep only one value for the same name. Remove duplicates before using the file in a system where their meaning would be ambiguous.

What to know

  • Maximum input: 2 million characters and 128 nested levels. Large documents can still slow the browser.
  • This is a formatter and syntax validator, not a JSON Schema validator or a repair tool.

Common questions

Will formatting round a large JSON number?

No. The formatter keeps the original numeric token instead of parsing it into a floating-point number. Software that later reads your downloaded JSON may have different numeric limits.

Can I format JSON with comments?

This tool validates strict JSON. Remove comments and trailing commas first; JSONC and JSON5 are different input formats.

Does sorting keys change my data?

It changes the order in which object members appear. JSON arrays retain their order, and values retain their original tokens. Consumers that rely on textual object order should leave sorting off.

Why does my valid JavaScript object fail validation?

JavaScript object literals can contain features JSON does not allow, including unquoted keys, functions, and undefined. Supply a JSON serialization instead.

Sources & references