JSON Formatter
Format, minify and validate JSON to make API responses easier to read and debug.
What is JSON Formatter tool?
A JSON formatter makes a compact API response, configuration file, or test fixture easier to read. Use this tool to inspect nested objects, check a payload before sending it, or remove unnecessary whitespace from valid JSON. It runs in your browser without an account; the formatting operation does not upload your input. Redact secrets before sharing copied results with anyone else.
Choose the right operation
Format parses one JSON document and produces two-space indentation. After formatting, switch to Tree to explore nested objects and arrays. Minify parses the same document and removes insignificant whitespace, not spaces inside string values. Validate checks syntax without rewriting your input; it does not check a business schema, required fields, or whether an API will accept the data.
Try an input and output
Paste this compact response and choose Format:
{"name":"Ada","roles":["editor"],"active":true}
The text output becomes:
{
"name": "Ada",
"roles": [
"editor"
],
"active": true
}
Choose Minify to return to compact JSON, or Validate to check the input without producing a replacement document. Copy only after reviewing the result.
Troubleshoot rejected input
JSON requires double-quoted keys and strings. Comments, trailing commas such as {"a":1,}, and multiple newline-separated documents are rejected. An HTML error page or a truncated response is not JSON either. Check the raw response body first. The error message comes from your browser's JSON parser, so wording and position details vary; this tool does not automatically repair malformed data.
Understand the limits before copying
Formatting and minification use JavaScript's JSON.parse and JSON.stringify, not a lossless text transformation. Integers above 9007199254740991 can lose precision, duplicate keys keep only the last value, and integer-like object keys can change order. Numeric notation can also change. Keep identifiers as strings at the source, or use a lossless parser when exact representation matters. Large documents can stall the browser; there is no guaranteed file-size limit.
For a YAML configuration workflow, continue with JSON / YAML Converter or YAML Formatter in the related tools. For tabular exports, use CSV / JSON Converter instead of manually editing delimiters. These are separate transformations: validate the converted result again before using it in an application.
FAQ
Formatting, minification, and validation run locally in your browser. These operations do not upload your input. Redact secrets before copying results into messages, tickets, or another service.
Check for single quotes, unquoted keys, unescaped characters, comments, trailing commas, or a truncated response. An HTML error page is not JSON. Parser messages depend on your browser and may not include a line and column; the tool does not automatically repair input.
No. Validate only checks whether one document can be parsed as JSON, without rewriting the input. It does not validate a JSON Schema, required fields, field types, or API-specific rules. Check those against the receiving API contract.
Not as a single document. This tool accepts one JSON value, not a stream of newline-separated objects. Validate each record separately, or use an NDJSON-aware parser. For CSV table data, use CSV / JSON Converter.
Yes. JavaScript JSON.parse and JSON.stringify can lose precision for integers above 9007199254740991, keep only the last duplicate key, reorder integer-like keys, and change numeric notation. Use strings for identifiers at the source, or a lossless parser when exact representation matters.
Indentation and line breaks make formatted output longer. Minification removes insignificant whitespace but keeps spaces within strings. It is not gzip or Brotli compression, and it does not guarantee the smallest possible byte representation.
Use the format required by the consuming application. JSON is strict and widely used for API payloads; YAML can be easier to edit by hand but has different typing and indentation rules. Use JSON / YAML Converter or YAML Formatter for that workflow, then verify the converted values.
Comments and trailing commas are rejected because this parser accepts strict JSON, not JSONC or JSON5. Large documents can block the browser or exhaust memory; there is no guaranteed size threshold. Use a suitable local parser for large or nonstandard documents.



