JSON Formatter and Validator
Format JSON with configurable indentation, minify it to a single line, or validate it before using it in an API request, config file, or test fixture.
What does this JSON formatter do?
Validation runs JSON.parse behind the scenes, the same parser the browser uses
for any application/json response. Errors include the offending line and column.
Prettifying is lossless: re-minifying the formatted output gives byte-identical JSON to the original (modulo whitespace).
When to prettify or minify JSON
Prettify JSON when reviewing API responses, config files, logs, or test fixtures. Minify JSON when you need a compact single-line payload for a request, document, or environment variable.
This formatter does not execute JSON or evaluate JavaScript. It only parses valid JSON and prints the result with the indentation you choose.
Use the API
Call the same encoder server-side or from another origin. CORS is open, no auth required for the free tier.
curl "https://encode-decode.org/api/v1/json\ ?action=encode&input=%7B%22a%22%3A1%7D"