All tools

JSON Formatter and Validator

Paste JSON below to validate it, see any error with its exact line and column, and get it beautified or minified as you type. Fix JSON repairs trailing commas, single quotes, unquoted keys, comments and missing brackets, and big numbers such as IDs keep every digit instead of being rounded. Nothing is uploaded.

Updated By Rules verified 2026-10-17Common JSON errors

Format and validate JSON

Paste, type, or drop a .json file here. Ctrl+Enter formats it.

✓ Valid JSON · 14 keys, 17 values, depth 4 · 229 B → 340 B

  • Line 1, column 55: 12345678901234567890 is bigger than 2^53, so JavaScript (JSON.parse) reads it as 12345678901234567000. This tool keeps it exact; send it as a string if other programs must keep every digit.

Advertisement

How to format and validate JSON

  1. Paste your JSON, upload a .json file or drop it on the box. Valid JSON is formatted at once.
  2. Read the error if it is invalid: it names the line, the column and the reason. Press Go to error to jump there.
  3. Press Fix JSON for common mistakes, then check the list of changes it made.
  4. Copy or download the result as formatted or minified .json, or as CSV for Excel and Google Sheets.
  5. Explore it in Tree view: click any value to get its JSONPath.

Common JSON errors and how to fix them

Every message and fix below comes from the same code that runs in the tool.

JSON mistakes, the validator's message and the Fix JSON result
MistakeInvalid JSONError messageAfter Fix JSON
Trailing comma{"name": "Ali", "age": 30,}Line 1, column 26: Trailing comma: remove the comma before }.{"name":"Ali","age":30}
Single quotes{'name': 'Ali'}Line 1, column 2: Property names must use double quotes ("), not single quotes.{"name":"Ali"}
Unquoted property name{name: "Ali"}Line 1, column 2: Property names must be in double quotes.{"name":"Ali"}
Missing comma{"name": "Ali" "age": 30}Line 1, column 16: Missing comma between properties.{"name":"Ali","age":30}
Python True or None{"active": True, "phone": None}Line 1, column 12: "True" is not valid JSON. Use lowercase true.{"active":true,"phone":null}
Comment{"age": 30 // years
}
Line 1, column 12: Comments are not allowed in JSON.{"age":30}
Line break inside a string{"note": "line one
line two"}
Line 1, column 19: Line break inside a string. Write it as \n.{"note":"line one\nline two"}
Number with a leading dot or zero{"price": .5, "code": 007}Line 1, column 11: Numbers need a digit before the decimal point (0.5, not .5).{"price":0.5,"code":7}
NaN or undefined{"score": NaN}Line 1, column 11: "NaN" is not valid JSON. Use null or a number.{"score":null}
Unclosed bracket{"tags": ["a", "b"Line 1, column 19: The array opened at line 1, column 10 is not closed with ].{"tags":["a","b"]}
Two objects without an array{"id": 1}
{"id": 2}
Line 2, column 1: Unexpected text after the end of the JSON. Only one top-level value is allowed; Fix JSON wraps several values in an array.[{"id":1},{"id":2}]

Advertisement

JSON syntax rules in one table

What JSON allows (RFC 8259 and ECMA-404)
TypeValidNot valid
String"Kuala Lumpur", "line\nbreak"'single', a raw line break, "\x41"
Number42, -3.5, 1.2e507, .5, +1, 0x1F, NaN, Infinity
Literaltrue, false, nullTrue, None, undefined
Object{"a": 1, "b": 2}{a: 1}, {"a": 1,}
Array[1, 2, 3][1, 2,], [1 2]
CommentsNone// note, /* note */

Why big numbers get rounded

JavaScript, and most formatters built on JSON.parse, store every number as a 64-bit float, which holds whole numbers exactly only up to 9,007,199,254,740,991 (2^53 − 1). RFC 8259 warns about this. Order numbers, tweet IDs and bank references beyond that are silently changed: 12345678901234567890 becomes 12345678901234567000. This formatter reads numbers as text, so the output keeps every digit, and it warns you so you can store such IDs as strings.

Note: Fix JSON guesses what you meant. A missing comma or bracket can be fixed in more than one way, so always check the repaired data, and fix the program that produced broken JSON rather than repairing it by hand every time.

Sources

Frequently asked questions

How do I format JSON online?

Paste your JSON into the box (or upload a .json file) and the formatted version appears at once with 2-space indentation. Choose 4 spaces or tabs, tick Sort keys to order properties alphabetically, or choose Minify to remove every space and line break. Copy the result or download it as a .json file. Nothing is uploaded.

Why is my JSON invalid?

The most common causes are a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, a missing comma between items, comments, and True, None or NaN copied from Python or JavaScript. JSON allows none of these. The validator names the first problem with its line and column, for example: in {"name": "Ali", "age": 30,} it reports line 1, column 26: Trailing comma: remove the comma before }.

What does Fix JSON change?

Fix JSON removes comments and trailing commas, turns single, curly and backtick quotes into double quotes, quotes unquoted keys, changes True, False and None to true, false and null, replaces NaN and undefined with null, adds missing commas, colons and closing brackets, strips a JSONP callback, unwraps JSON saved as a string and wraps several values in an array. It lists every change it made; check the result before using it.

Does formatting change my numbers?

No. Numbers are kept exactly as written, so 2.50 stays 2.50 and 12345678901234567890 keeps every digit. Most online formatters run JSON.parse, which stores numbers as 64-bit floats and rounds integers above 9,007,199,254,740,991 (2^53 − 1): 12345678901234567890 becomes 12345678901234567000. The tool warns when your data has such numbers, so you can send IDs as strings.

How do I convert JSON to CSV?

Choose Download CSV. Each item of a top-level array becomes a row; if the JSON is an object such as {"data": [...]}, the first array of objects inside it is used. Nested keys become columns such as address.city, lists of values are joined with semicolons, and text starting with =, +, - or @ gets a leading apostrophe so Excel does not run it as a formula. The file is UTF-8 with a byte order mark so Excel shows Malay and other accents correctly.

What is JSONPath and how do I find the path to a value?

JSONPath (RFC 9535) is a way to point at a value inside JSON, such as $.items[0].price for the first item's price or $.items[*].name for every name. Switch to Tree view and click any value to see its path, or type a path into the JSONPath box to look values up. Negative indexes such as [-1] pick the last item.

Is my JSON uploaded or saved?

No. The formatter runs entirely in your browser with JavaScript, so API keys, tokens and customer data in your JSON never leave your device. Only your options (mode, indent, sort keys) are remembered in this browser. Files up to 20 MB work; output updates as you type for JSON up to 300 KB, and larger files update when you press Format or Ctrl+Enter.

Advertisement