Utilify

JSON Formatter & Beautifier

Format, beautify, and validate JSON online. Free, fast, runs entirely in your browser.

Built and maintained by Jay SooUpdated August 15, 2026

How to use JSON Formatter

  1. 1
    Paste your JSON

    Paste raw JSON into the input area.

  2. 2
    Click Format

    Press Format to pretty-print with 2-space indentation. Errors are flagged inline.

  3. 3
    Copy the result

    Use the Copy button to copy formatted JSON to your clipboard.

About JSON Formatter

JSON (JavaScript Object Notation) is the de facto data interchange format for modern APIs, configuration files, and logging systems. While easy for machines to parse, the raw JSON returned by services is often minified — all on one line with no whitespace — which makes it nearly impossible for humans to read or debug at a glance.

Formatting (also called "beautifying" or "pretty-printing") re-emits the same data with consistent indentation and line breaks so the structure becomes visible: arrays, nested objects, and key-value pairs each get their own line. Utilify's JSON Formatter runs entirely in your browser using the built-in JSON.parse and JSON.stringify APIs — your data never leaves your device, regardless of how sensitive it is. Switch to minify mode to do the inverse: strip all whitespace into a single compact line ready for transport.

Formatting is also the fastest way to catch structural mistakes. Because the tool parses the text before it prints, a misplaced bracket, an unterminated string, or a trailing comma stops the process and surfaces an error instead of silently producing garbage. Once the JSON is indented, mismatched nesting becomes obvious — a closing brace that lands at the wrong depth jumps out immediately, where on a single minified line it is invisible.

Choosing an indentation width is mostly a matter of house style. Two spaces is the most common default and keeps deeply nested payloads from marching off the right edge of the screen; four spaces reads more clearly for shallow objects. Whichever you pick, consistency across your team and config files keeps version-control diffs small and focused on real changes rather than reformatting noise.

Importantly, formatting never alters the underlying data. Key order, numeric precision, string contents, and boolean and null values are all preserved exactly — only the whitespace between tokens changes. That means you can format a payload, inspect it, minify it again, and send the byte-identical data back out with full confidence.

2-space vs 4-space vs tabs vs minified

Indentation is house style, but each choice has real trade-offs. Here is how the common options compare in practice:

StyleBest forTrade-off
2-space indentMost JS/TS codebases, deeply nested payloads, web configs like package.json and tsconfig.jsonSlightly denser to scan than 4-space
4-space indentShallow objects, documentation, teams coming from PythonDeep nesting marches off the right edge of the screen
TabsAccessibility — each reader sets their own tab width in their editorRenders at different widths everywhere; rare in JSON style guides
MinifiedNetwork payloads, storage, single-line log entriesUnreadable by humans; version-control diffs become useless

Whichever style you pick, apply it consistently across the repo — mixed styles turn every diff into reformatting noise.

When to use JSON Formatter

  • Debugging API responses

    Paste the raw response from your browser DevTools Network tab to see structure at a glance.

  • Reviewing config files

    Format package.json, tsconfig.json, or any config before committing to keep diffs readable.

  • Inspecting webhook payloads

    Webhooks often arrive minified. Format them locally without forwarding to a third-party service.

Examples

Minified → Pretty
Input
{"name":"alice","age":30,"tags":["admin","beta"]}
Output
{
  "name": "alice",
  "age": 30,
  "tags": [
    "admin",
    "beta"
  ]
}

JSON mistakes this formatter catches constantly

  • Trailing commas

    Valid in modern JavaScript, invalid in JSON (RFC 8259). A single trailing comma after the last item makes JSON.parse throw. This is the most common paste-in error we see.

    {"name": "alice", "age": 30,}   ← trailing comma: parse error
  • Single quotes or unquoted keys

    JSON requires double quotes around both keys and string values. Object literals copied from JS source with single quotes or bare keys will not parse.

    {'name': alice}   ← must be {"name": "alice"}
  • Comments in JSON

    JSON has no comment syntax. Files like tsconfig.json only accept // comments because tools parse them as JSONC, a superset. Strip comments before feeding JSON to a strict parser.

  • Big integers silently losing precision

    JavaScript numbers lose precision above 2^53 − 1 (9007199254740991). IDs from Twitter, Discord, or Snowflake-style generators get rounded when parsed — which is why those APIs also ship an id_str field. Keep 64-bit IDs as strings.

    JSON.parse('{"id": 10765432100123456789}').id
    // → 10765432100123458000 (silently wrong)
  • NaN and Infinity

    Neither is a legal JSON value. JSON.stringify converts them to null; other serializers throw. If a payload needs them, encode them as strings and document the convention.

  • Duplicate keys

    Technically parseable, but behavior is implementation-defined: JavaScript keeps the last occurrence, some parsers keep the first, and some reject the document. Never rely on duplicates surviving a round trip.

Frequently asked questions

Is my JSON sent to a server?+

No. All formatting happens locally in your browser using the native JSON.parse and JSON.stringify APIs. Nothing leaves your device, so it is safe to paste sensitive payloads.

What happens if my JSON is invalid?+

The formatter parses before printing, so invalid input produces an inline error message describing the problem — typically a missing comma, unquoted key, or mismatched bracket — instead of malformed output.

Can I minify JSON instead of beautifying it?+

Yes — toggle Minify to strip all whitespace into a single compact line ready for transport or storage.

Should I indent with 2 or 4 spaces?+

Two spaces is the most common default and keeps deeply nested data on screen; four spaces reads more clearly for shallow objects. The data is identical either way, so pick whatever matches your project style.

Does formatting change my data or reorder keys?+

No. Formatting only changes the whitespace between tokens. Key order, numbers, strings, booleans, and null values are all preserved exactly.

What is the difference between formatting and validating?+

Formatting assumes the input is valid and rearranges its whitespace for readability. Validating checks whether the input can be parsed at all and pinpoints where it fails. This tool does both: it validates as it formats.

Related tools

From the blog