JSON Formatter, Validator and Viewer

Paste JSON to format it, minify it or check whether it is valid. Syntax errors come back with the exact line, column and a plain-language reason. Everything runs in your browser.

Free, no account, and it runs on your device

How to format JSON

  1. Paste the JSON into the box, or press Load example to see the output first.
  2. Choose two spaces, four spaces or a tab, and whether keys should be sorted.
  3. Press Format to pretty-print, Minify to strip the whitespace, or Validate only to check without changing anything.
  4. Copy the result or download it as a .json file.

Reading a JSON error message

Most formatters say "invalid JSON" and stop there. The parser knows where it gave up, so this page shows the line, the column and what it expected. The five mistakes below account for almost every failure:

What you wroteWhy it failsFix
{"a": 1,}Trailing commaRemove the comma before } or ]
{'a': 1}Single quotesUse double quotes for every key and string
{"a": 1 // note}CommentDelete it; plain JSON has no comments
{a: 1}Unquoted keyWrite "a"
{"a": 1 "b": 2}Missing commaAdd a comma between members

Two more causes are invisible on screen. Word processors and chat apps sometimes replace straight quotes with curly ones, which look like " but are not. And a file that starts with an invisible byte-order mark is accepted by some parsers and rejected by others; this tool strips it before parsing.

JSON syntax in one screen

JSON is defined by RFC 8259 and ECMA-404. A value is one of six things: an object, an array, a string, a number, true/false, or null. Objects use string keys, arrays keep order, strings must use double quotes, and commas separate members without a trailing one. That is the whole language — there are no dates, no comments, no functions, no undefined, and no way to write a number in hexadecimal.

Because the format is small, almost every JSON question in practice is about semantics rather than syntax: which key wins when two are duplicated, how a date should be encoded, and how to carry an integer that is too large for a double.

Numbers that JSON cannot carry safely

JSON itself allows any decimal number of any size. JavaScript does not: a number is an IEEE 754 double, which is exact only up to about 9 quadrillion. Twitter's snowflake IDs, some payment references and several database keys exceed that, and formatting such a file in a JavaScript tool can change the last digits.

This formatter scans the raw text for integer literals above the safe limit and lists them, so you can decide before saving. The durable fix is to send those values as strings — "id": "1234567890123456789" — which every JSON parser handles exactly. If the payload is not yours to change, format it with a tool that preserves the number lexically rather than through a JavaScript number.

Format or minify?

  • Format when you are reading an API response, reviewing a config file or comparing two versions in a diff. Indentation makes structure visible.
  • Minify before sending or storing: whitespace can be a large share of a small payload, and every byte costs bandwidth on a slow mobile connection.
  • Validate only when the file is already formatted and you just need a yes or no before a deploy.

Formatting never repairs anything. If the input is invalid, the output is an error, not a guess — a formatter that silently deletes a stray comma has hidden a bug that will come back in production.

Privacy and limits

Parsing and rewriting happen in the tab. Nothing is uploaded, no payload is logged, and closing the page discards the text. The practical limit is memory: a few megabytes are fine on a phone, larger files can freeze the tab while the browser builds the output string.

Related tools: encode or decode Base64 for the payloads you find inside tokens and data URIs, count words and characters, or generate a QR code for a documentation link.

Questions people ask

Is my JSON sent to a server?

No. The text is parsed and rewritten inside your browser tab. Nothing is uploaded, which matters when the payload contains an access token, a customer record or a private API response.

Why did a long number change after formatting?

JavaScript stores numbers as 64-bit floating point values, so integers above 9,007,199,254,740,991 cannot be represented exactly. When the tool spots an integer that large it warns you, because formatting would silently round it — the classic case is a 19-digit database or payment ID. Keep such values as strings in the JSON.

What is the difference between formatting and minifying?

Formatting adds indentation and line breaks so a human can read and diff the file. Minifying removes every byte that is not needed, which is what you send over the network. Both produce the same data; only the whitespace differs.

Does it accept JSON with comments or trailing commas?

No, and that is deliberate. JSON.parse — the parser your app will use — rejects both. If this tool accepted them, a file would look valid here and then fail in production. JSON5 and JSONC allow comments, but they are different formats and need a different parser.

How large a file can it handle?

A few megabytes is comfortable on a phone. Beyond that the browser can stall while stringifying, because the whole document is held in memory twice. For multi-megabyte exports, use a command-line tool such as jq.

Can I sort keys without changing the data?

Yes. Sorting only reorders object members, which JSON treats as unordered, so the meaning is unchanged. Arrays keep their order because array order is data. The one thing to watch is a tool downstream that compares raw strings, such as an ETag or a checksum.

Updated · 28 Kartik 2083 BS