How-to
How to format JSON online
Raw JSON from an API response or config file is often minified into an unreadable single line. Reading, debugging, or editing it in that state is frustrating. This guide shows how to pretty-print JSON with clean indentation, pinpoint syntax errors with line numbers, and minify it back when finished, with every operation processed entirely inside your browser.
To format and validate JSON privately without sending API payloads to a server, paste up to 5 MB of text into a browser-local formatter powered by native JSON.parse() and JSON.stringify(). Choose 2-space or 4-space indentation, pinpoint syntax errors by exact line and column, or minify whitespace in one click.
Step by step
- Open the JSON formatter and paste your JSON into the left panel. You can paste directly from a clipboard (Ctrl+V), from a command-line curl response, or from any text editor. The input accepts any size within the tool's limit.

- Choose the mode. Format adds indentation (2 or 4 spaces, your choice); Validate just checks syntax without modifying the JSON; Minify strips all whitespace to produce the smallest possible output. For most use cases, Format is what you want.
- Click Run. The formatted output appears in the right panel. Copy it with the Copy button and paste it back into your editor or config file. The tool shows line count and character count so you can verify the output size at a glance.

Reading the error messages
When your JSON has a syntax error, the formatter reports the exact line and column where parsing failed. The usual RFC 8259 violations are a trailing comma after the last item in an object or array (valid in JavaScript, forbidden in JSON), unquoted keys or single-quoted strings, inline comments, or unescaped control characters inside strings. Also watch for 64-bit integer IDs exceeding JavaScript's IEEE 754 safe integer limit (9007199254740991): standard JSON.parse() rounds larger unquoted integers, so APIs should serialize Snowflake or database IDs as strings before formatting.
| Feature | V8 JSON.parse (Chromium) | SpiderMonkey (Firefox) | JavaScriptCore (Safari) |
|---|---|---|---|
| File size cap | Raw V8 ≤ 512 MB (Tool Cap: 5 MB) | Raw Engine ≤ 256 MB (Sunasty Cap: 5 MB) | Raw Engine ≤ 256 MB (Sunasty Cap: 5 MB) |
| Output & limits | ~ 150–250 MB/s In-Memory | ~ 120–200 MB/s In-Memory | ~ 140–220 MB/s In-Memory |
JSON, YAML and CSV: when to use which
JSON is the standard for API responses and configuration files that need to be consumed by code. YAML is preferred for human-edited configuration (less punctuation, supports comments). CSV is best for tabular data consumed by spreadsheets. The data converter on this site lets you convert between these three formats in one step: paste JSON, click Convert, get YAML or CSV out. Minified JSON is also useful when you need to embed data in a URL query parameter or in an HTTP header with a size limit.
| Feature | Syntax Error (Trailing Comma) | Single Quotes & Unescaped Chars | JSONC (Comments / //) |
|---|---|---|---|
| Reference | {"key": "val",} (RFC 8259 Violation) | {'key': 'val'} or unescaped \t, \n | /* comment */ or // line comment |
| Best for | Strip Trailing Commas via Regex | Normalize to Valid RFC 8259 Double-Quotes | Strip Comments before Native JSON.parse |
How browser-side JSON parsing works
When you paste a payload into a browser-based formatter, the page calls the JavaScript engine's native JSON.parse(), which tokenizes and validates the text entirely in the current tab's process. The parsed object is then passed to JSON.stringify() with an indentation argument to produce pretty-printed output. Because both functions are part of the ECMAScript standard, they run in the same sandboxed context as any other script on the page and make no network calls. One practical limit to be aware of: JSON.parse() loads the entire document into memory as a JavaScript object tree. Very large payloads (tens of megabytes) can cause noticeable delays or hit browser memory limits; for those cases, a streaming JSON parser is necessary.
What formatting does not validate
The formatter parses JSON syntax and rewrites valid input with indentation or compact spacing. A successful result means the text is syntactically valid JSON; it does not show that required properties exist, that a field has the right business meaning or that a payload satisfies an API contract. This tool has no JSON Schema validator, JSONPath selector or jq query interface. Check the receiving system's documented schema separately when those constraints matter. Formatting also preserves neither duplicate object keys as separate values nor an arbitrary-precision numeric representation through JavaScript parsing. Keep the source and inspect identifiers and large numbers before using the formatted copy in another system.
The tools used in this guide
- JSON FormatterFormat, validate, minify, escape, sort keys A-Z, and repair JSON or JSONC with exact line and column error reporting.
- Data ConverterConvert data between JSON, YAML and CSV, or export arrays of objects to Markdown tables and SQL INSERT queries.
- Minify / BeautifyMinify or beautify HTML, CSS, and JavaScript with Terser AST parsing, Gzip size estimation, and file export.
- XML Formatter & ValidatorFormat, beautify, minify, validate XML 1.0 syntax, inspect the interactive element tree, and run XPath queries locally in your browser.
- URL Encoder / DecoderPercent-encode a URL component or full URL, decode escaped strings, and inspect query parameters.
Separate formatting, comparison and schema validation
Consider {"enabled":true,"retries":3} and {"retries":3,"enabled":true}. Formatting both produces readable output, but their member order remains different. A text comparison can flag that ordering change even though these two objects contain the same names and values. This example does not generalize to arrays: changing array order can change meaning.
Now change retries from the number 3 to the string "3". Both inputs remain valid JSON and both format successfully. Their value types differ. The formatter checks JSON syntax; it does not compare two documents, apply your application schema, or decide whether retries is allowed to be a string. There is no schema-upload step in this tool.
Keep each original, format copies with the same settings, and review a text diff with ordering in mind. Check value types and array positions separately. If your application has a schema, validate against that actual schema with a suitable validator. A clean formatting result establishes parseable syntax, not compatibility with your API or configuration.
Frequently asked questions
Is my JSON sent to any server?
No. The formatter runs entirely in your browser. Your JSON is parsed with the browser's native JSON.parse and the output is built in memory: nothing travels over the network. This matters when the JSON contains API keys, tokens, internal data or personal information, which is common in API debugging workflows.
What is the maximum size I can paste?
The formatter accepts JSON up to 5 MB. Beyond that, parsing on the main thread would freeze the browser tab with no feedback. For larger JSON files, use a dedicated desktop tool like jq on the command line (jq . file.json), which handles hundreds of megabytes without issue.