Skip to content

JSON Formatter

In-browser only RFC 8259 JSON parser
The result appears here once you enter JSON.
Runs entirely in your browser with the built-in JSON parser.

Overview

Format, validate, minify, and lint JSON in your browser

Pretty-print messy JSON with clean, consistent indentation. Paste your JSON, pick an indent style, and copy the formatted result.

Guide

How to use

  1. 1
    Paste your JSON

    Type, paste, or use the Paste button to pull JSON from your clipboard. The Sample button loads a small example to try.

  2. 2
    Choose an action

    Switch between Format, Validate, Minify, and Lint using the tabs. The same input is reused — no need to paste again.

  3. 3
    Read the result

    Formatted and minified output appears in the result pane; validation shows a clear verdict; lint lists every issue with its location.

  4. 4
    Copy or download

    Use Copy to send the result to your clipboard. On the Format and Minify tabs you can also Download the result as a .json file.

Reference

What JSON Lint checks

What JSON Lint checks
IssueWhat it means
Duplicate keyTwo properties in one object share a key — parsers keep only one value.
Trailing commaA comma before a closing bracket or brace — not allowed in strict JSON.
Comment// or /* */ comments — valid in JSON5/JSONC but rejected by JSON.
Single-quoted stringStrings or keys in single quotes — JSON requires double quotes.
Unquoted keyAn object key without quotes — JSON requires every key to be double-quoted.
Byte-order markA hidden BOM character at the start of the input that can confuse parsers.

Pitfalls

Common JSON mistakes

  • Trailing commas

    A comma after the last item in an array or object is fine in JavaScript but invalid in JSON. Remove the comma before the closing bracket or brace.

  • Single quotes

    JSON requires double quotes for every string and key. Single quotes are a JavaScript habit — the Lint tab flags each one so you can swap them.

  • Unquoted keys

    JavaScript object literals allow bare keys like {name: "x"}, but JSON needs {"name": "x"}. Every key must be wrapped in double quotes.

  • Comments

    JSON has no comment syntax. // and /* */ comments are valid in JSON5 and JSONC but a standard parser will reject them — strip them before parsing.

Frequently asked questions

What indentation should I use — 2 spaces, 4 spaces, or tab?
It depends on your team's style guide. 2 spaces is the most common default in JavaScript and TypeScript projects, 4 spaces is popular in Python and Java, and tabs let each developer set their own display width. All three produce equally valid JSON.
Does formatting change my data?
No. Formatting only changes whitespace — indentation and line breaks. The keys, values, and structure are identical to your input. The key order is preserved exactly as you entered it.
Is my JSON sent to a server?
No. Formatting runs entirely in your browser using the built-in JSON parser. Your data never leaves your device — you can confirm this in your browser's network tab.
It says my JSON is invalid — what now?
The formatter needs valid JSON to pretty-print. When parsing fails it shows the exact line and column of the problem. Switch to the Lint tab to see every issue at once, such as trailing commas or single quotes.