Tools

Data tool

JSON formatter

Paste JSON to format, minify, validate, or sort object keys. Parsing happens locally in the browser with built-in JSON support.

Input

JSON source

Output

Processed JSON

Example cleanup

Paste a compact response such as `{"ok":true,"items":[1,2]}` and Format will produce two-space indentation without changing array order. Minify removes insignificant whitespace and returns one line, which is useful for an environment variable or a small request fixture. Both modes parse and serialize the value, so cosmetic spacing from the source is intentionally replaced.

What it checks

The formatter uses the browser's `JSON.parse`, so it rejects single-quoted property names, comments, trailing commas, missing commas, and unescaped control characters. A parser error leaves the result empty instead of returning partly repaired data. It validates JSON syntax only; it does not check required fields, value types, or an application schema.

Privacy

Parsing, formatting, and key sorting run in this browser tab. The tool does not upload, store, or send the JSON to a server. The default sample is part of the page; your replacement input remains local until you deliberately copy it or paste it into another product, where that product's policy applies.

When to sort

Sort keys alphabetizes object keys at every nesting level, while arrays keep their item order. This can make snapshots and manual comparisons easier, but it changes the source's object-key presentation and is not a semantic schema sort. Use regular Format when the pasted order is meaningful to reviewers or documentation readers.

Paste JSON and switch between format, minify, and alphabetical key sort. Under the hood the page uses the browser JSON.parse / JSON.stringify pair with a 2-space indent. Do not paste live secrets.

Verified modes

Input {"z":1,"a":[3,1],"m":"한글"}:

Mode Result
Format Keeps key order z→a→m, array [3,1], multi-line
Minify {"z":1,"a":[3,1],"m":"한글"}
Sort Keys a→m→z; array values stay [3,1]

Sort walks nested objects but never reorders arrays, so event logs keep chronology while keys become diff-friendly.

Workflow

  1. Paste an API payload.
  2. Format to read structure.
  3. If parse fails, fix around the reported position (often the real bug is a trailing comma a few tokens earlier).
  4. Sort both sides before diffing configs.
  5. Minify only for transport or storage.

Limits

No JSON5, comments, or trailing commas. Integers outside the safe JS range should stay strings. Duplicate keys are undefined territory—do not emit them. Pair with the workbench when you also need CSV or YAML in the same session.

Why sort exists

Generated JSON often randomizes key order between environments. Diffing two pretty-printed payloads then looks like a full rewrite even when values match. Running sort on both sides collapses that noise. Nested objects are sorted at every depth; arrays keep order so chronological logs stay honest.

Use format while exploring. Use sort when comparing. Use minify when emitting to a size-sensitive channel. Do not minify as your only saved source of truth if humans must edit the file later.

Failure reading tips

Parser positions mark detection, not always the edit site. A missing closing brace reports at end-of-input. A trailing comma after the last array element usually points near the following token. Prefer fixing the grammar, then formatting—minifying invalid JSON never repairs it.

JavaScript object literal habits (single quotes, bare keys, comments) are the most common paste mistakes from the console. Convert those to strict JSON before expecting this tool to help.

Large integers, especially order IDs beyond Number.MAX_SAFE_INTEGER, should be quoted as strings before they ever reach JSON.parse in JavaScript. The formatter will not invent a bigint type for you.

Pairing with other tools

After CSV→JSON, paste here to indent before code review. After YAML→JSON, sort both expected and actual payloads before diffing in CI discussions. Minify only at the edge that cares about bytes. The workbench hosts the same JSON engine if you need to hop to Base64 or hashing next without another tab.

Guardrails for teams

Adopt a simple house rule: fixtures committed to git are either sorted pretty JSON or documented YAML. Random key order in committed files creates review churn. Run sort before saving golden files. Keep minify for network captures and generated bundles, not for human-edited sources.

When an error message is opaque, copy only the failing substring into a minimal repro. Smaller inputs make the detection pointer easier to map to a missing comma or quote.

FAQ

What is the difference between format and sort?

Format only pretty-prints with 2-space indent and keeps key order. Sort recursively reorders object keys alphabetically, then pretty-prints. Array element order never changes.

What happens on a trailing comma?

JSON.parse rejects it. The status line shows the engine message and the output clears.

Is input uploaded?

No. Parse and serialize run in this tab only.

Will Hangul become \u escapes?

No. JSON.stringify keeps Hangul as characters.