JSON Formatter and Validator

Beautify minified JSON with two-space indentation and pinpoint syntax errors by line and column. Handy for API responses, log lines, webhooks and config files.

The output will appear here.
Advertisement Clicker Alchemist — a mobile game by icyabmod, on Google Play and the App Store

How JSON Formatter and Validator works

Beautify minified JSON with two-space indentation and pinpoint syntax errors by line and column. Handy for API responses, log lines, webhooks and config files.

Input JSON
Output Formatted JSON
Works done 2,928

How to use it

This JSON formatter turns minified or hand-edited JSON into clean, two-space indented text and checks the syntax in the same step. If the input is invalid, you get the parser's error message with the line and column where it stopped, so you can jump to the missing comma or stray quote. Everything runs in your browser; the data you paste is not sent to a server.

How to use the JSON formatter

  1. Paste your JSON into the input box: an API response, a single log line or the contents of a config file.
  2. Click "Run tool", or press Ctrl + Enter (Cmd + Enter on macOS).
  3. Read the result: indented output means the JSON is valid, while an error message points to the first problem.
  4. Fix the reported spot in your source, run the tool again, then copy the output or download it as a text file.

What the error messages actually mean

The message comes from the browser's built-in JSON parser, so its wording depends on the browser you use. A typical one reads Expected ',' or '}' after property value in JSON at position 34 (line 4 column 3). Here position is a zero-based character offset, while line and column start at 1 and match what your code editor shows. Another engine might report the same issue as JSON.parse: expected ',' or '}' after property value in object at line 4 column 3 of the JSON data.

Keep in mind that the parser reports where it noticed the problem, not where you made it. A missing comma at the end of line 3 is only detected when the next key begins on line 4. The usual suspects:

  • Expected double-quoted property name: a trailing comma such as {"a": 1,}, which JavaScript tolerates and JSON does not.
  • Expected property name or '}': single-quoted or bare keys like {'id': 1} or {id: 1}, or curly quotes pasted from a word processor or chat app.
  • Unexpected token 'u': values that have no JSON equivalent, such as undefined, NaN or a capitalized True.
  • Bad escaped character: an unescaped Windows path such as "C:\Users\sam". Each backslash must be doubled.
  • Bad control character in string literal: a real line break inside a string. Inside JSON strings a newline has to be written as \n.
  • Unterminated string or Expected ',' or ']' after array element: the text was cut off while copying, often from a truncated log viewer.

Strict JSON versus the JSON-like files you meet every day

A lot of files look like JSON but follow looser rules. The formatter applies the strict standard (RFC 8259), so it is useful to know which inputs will be rejected and why.

InputTypical sourceResult here
JSONC (comments, trailing commas)tsconfig.json, editor settingsError at the first comment; the file is not necessarily broken
JSON5 (unquoted keys, single quotes)Some build configsError at the first bare key
JSON Lines / NDJSONLog exports, data dumpsUnexpected non-whitespace character after JSON at line 2
Python dict printoutprint(data) in a scriptError at the first single quote; generate it with json.dumps instead
A single value such as "hello" or 42Minimal API responsesValid; printed as is

Side effects of a parse-and-print round trip

The tool does not re-indent your text character by character. It parses the data and prints it again, which keeps the meaning intact but can change how some values are written:

  • Integers above 9,007,199,254,740,991 lose precision, so 12345678901234567890 comes back as 12345678901234567000. If you handle long order numbers or social media IDs, send them as strings.
  • Numbers are normalized: 1.50 becomes 1.5 and 1e3 becomes 1000.
  • Escapes are resolved, so "\u00e9" prints as the actual accented letter and "\/" prints as a plain slash.
  • Duplicate keys collapse silently and the last value wins. {"a":1,"a":2} prints as a single "a": 2.
  • Keys that look like non-negative integers, such as "2024" or "10", move to the top of their object in ascending order. All other keys keep their original order.

Where a formatter earns its keep

  • Debugging an API: paste a one-line response from the terminal and spot the field that came back null or the array that is unexpectedly empty.
  • Reading structured logs: many logging setups write each event as one line of JSON. Formatting a single line makes nested context readable.
  • Reviewing config changes: validate package.json or a manifest after a manual edit, before it breaks a build.
  • Comparing versions: format both payloads with the same indentation, then run them through the text diff checker so only real changes show up.
  • Moving data on: send an array of objects to the JSON to CSV converter for a spreadsheet, or decode a token segment first with the Base64 decoder.

Privacy and limits

Formatting happens with JavaScript in your own browser tab. What you paste stays on your device; the page only increments an anonymous usage counter. That matters when a response contains access tokens, customer emails or internal hostnames. Very large inputs can make the tab pause briefly. Note that this is a syntax check, not schema validation: a missing required field or a number sent as a string will not be flagged. For a broader workflow, see the guide to working with JSON data or browse the other developer tools.

Advertisement icyabmod — get a website for your business, design it on a live demo

Frequently asked questions

Not in meaning. Keys, values and nesting stay the same; only whitespace is added. Because the tool parses and re-prints the data, a few spellings can change: very large integers are rounded, 1.50 is written as 1.5, escape sequences are resolved and a duplicated key keeps only its last value. If none of those apply to your payload, the formatted output is a drop-in replacement for the original.

JSON is a much smaller language than JavaScript. Object literals allow unquoted keys, single quotes, trailing commas, comments, undefined and functions; JSON allows none of them. Keys must use double quotes, and only strings, numbers, true, false, null, objects and arrays are permitted. The quickest fix is to run JSON.stringify on the object in your code or browser console and paste that output here instead.

No. This page only produces indented output with two spaces per level. For compact JSON, call JSON.stringify(data) without the spacing argument in your code, which removes every optional space and line break. Keep in mind that for data sent over HTTP, server compression such as gzip or Brotli usually shrinks whitespace very effectively, so pretty-printed responses cost less than their raw size suggests.

JSON Lines puts one complete JSON document on each line, so the file as a whole is not a single valid JSON value and the parser stops at the start of line 2. Either paste one line at a time, or wrap the lines in square brackets and separate them with commas to turn them into an array. The second approach is handy when you want to inspect a small sample of records together.

The formatting runs entirely in your browser and the pasted text is not transmitted to the server, so the tool itself does not expose your data. General care still applies: avoid pasting secrets on shared or untrusted computers, clear the input when you are done, and rotate any token that you suspect has leaked elsewhere. Browser extensions with page access can read what is on screen, as they can on any site.