JSON guide

Prettify JSON Online

Prettify JSON online with clean indentation, validation feedback and one-click copy.

Open JSON Formatter

How to do it

  1. Paste a single JSON value (object, array, string, number, boolean or null).
  2. Click Format JSON to prettify with two-space indentation.
  3. Copy the result, or pipe it into JSON Validator and JSON Sorter for further cleanup.

Prettify in JavaScript and Python terms

If you have ever written JSON.stringify(value, null, 2) in JavaScript or json.dumps(data, indent=2) in Python, you have used the prettify operation in code. This online tool is the same idea moved into the browser so you can prettify ad-hoc JSON without writing a script. Internally it parses with the standard JSON parser and re-serializes with a fixed indent, exactly how the language built-ins behave.

Prettify, then sort, then diff

Prettifying is usually the first step in a longer cleanup. After prettifying, sorting object keys with JSON Sorter makes diffs deterministic — two responses with the same content but different key order will look identical, which is the behavior you want when a flaky API shuffles keys between requests.

If you are comparing two responses, prettify both, sort both, then paste them into JSON Compare to see only the structural differences.

  • Prettify: produce readable output.
  • Sort: stabilize key order so diffs are signal-only.
  • Compare: show added, removed and changed fields between two payloads.

Prettify vs jq

If jq is already in your terminal, jq '.' is a great prettifier. The browser tool wins when you want to share a URL with someone, when you need to prettify a single payload without leaving your browser, or when the input is broken JSON that would make jq fail. AI JSON Repair plus the prettifier on this site handle messy input that jq refuses to parse.

Examples

Prettify a log-line JSON entry

Input

{"level":"info","msg":"request handled","ctx":{"path":"/users","status":200,"ms":42}}

Output

{
          "level": "info",
          "msg": "request handled",
          "ctx": {
            "path": "/users",
            "status": 200,
            "ms": 42
          }
        }

Logs typically print JSON on one line. Prettifying turns each request into something you can scan in a review.

Recommended tool

Related guides

FAQ

What is prettified JSON?

Prettified JSON is JSON printed with line breaks and indentation so nested structure is visible to a human.

Why prettify JSON?

It makes nested data easier to inspect, easier to share in a code review, and easier to compare against another response.

Can I prettify JSON from logs?

Yes, as long as the JSON portion is extracted and is valid (or repaired first with AI JSON Repair).

Is prettify the same as JSON.stringify(value, null, 2)?

Yes. The output matches the standard library behavior for two-space indentation.

Can I pick the indent width?

The default is two spaces, which matches JS and Python convention. Different indent widths can be added later.