A JSON formatter that tells you what is wrong
This free JSON formatter turns a wall of minified data into readable, indented JSON and checks it at the same time. Paste an API response, a config file or a log line and you get three things at once: a JSON validator that points to the exact line and column of the first error, a JSON beautifier with 2-space, 4-space or tab indentation, and a minifier for when you need the compact version back. A tree view, key sorting, JSON Schema validation and JSON to CSV conversion are one click away.
Everything runs in your browser. The tool uses its own small parser rather than sending your data to a server, which is why it can explain errors in plain words and why private payloads such as tokens, customer records or internal configs never leave your machine.
How to read a JSON error message
Most JSON errors are not where the parser stops, but just before it. When the validator says Line 3, column 9: Trailing comma before "}", it shows the line with a caret under the problem character, so you can see the comma that should not be there. A few patterns cover most real-world cases:
-
Trailing comma. JavaScript allows
[1, 2,]; JSON does not. Remove the last comma. -
Single quotes or unquoted keys.
{name: 'Ann'}is a JavaScript object, not JSON. Keys and strings need double quotes:{"name": "Ann"}. -
Comments. JSON has no comments. Files such as tsconfig.json accept them because their tools use a looser format, but a strict JSON parser rejects
//and/* */. -
Missing comma or bracket. If the error appears at the start of a property, look at the end of the line above it. If the error is "unexpected end of input", a closing
}or]is missing somewhere. -
Python or JavaScript values.
True,None,NaNandundefinedare not JSON. Usetrue,nullor a number. -
Curly quotes. Text copied from a word processor or chat app often contains typographic quotes that look almost the same as
".
The "Fix common mistakes" button repairs comments, single quotes, unquoted keys, trailing commas, curly quotes and Python-style values in one pass and lists what it changed, so you can review the result instead of trusting it blindly.
Big numbers and duplicate keys
JSON itself has no size limit for numbers, but JavaScript stores them as 64-bit floats. An ID such as 12345678901234567890 becomes 12345678901234567000 after a normal JSON.parse. This formatter keeps every number exactly as you wrote it and warns you when a value is above 2^53, which is a sign it should travel as a string. It also flags duplicate keys: the JSON standard does not forbid them, but most parsers silently keep only the last one, which hides bugs.
JSON Schema validation in a nutshell
A JSON validator checks syntax. JSON Schema checks meaning: which fields are required, what type each one has, which values are allowed. A small schema looks like this:
{"type": "object", "required": ["id", "email"],
"properties": {"id": {"type": "integer", "minimum": 1},
"email": {"type": "string", "format": "email"}}}
The JSON Schema tab supports the core of draft 2020-12: types, enum and const, number and string limits, pattern, the common formats (email, date, date-time, uri, uuid, ipv4, hostname), properties, required, additionalProperties, patternProperties, items and prefixItems, uniqueItems, contains, allOf, anyOf, oneOf, not, if/then/else and local $ref links to $defs. Each error shows the instance path, such as $.users[1].email, and the schema path that failed. Keywords the tool does not evaluate, like unevaluatedProperties, are listed instead of silently ignored. If you do not have a schema yet, generate a first draft from a sample document and tighten it by hand.
Writing schemas for a whole API is a bigger job. If you also need structured data on web pages, the schema markup validator checks JSON-LD for search engines, which is a different kind of schema.
Convert JSON to CSV and back
Spreadsheets want rows and columns. The converter takes an array of objects, uses the union of all keys as the header, flattens nested objects into dot.notation columns and keeps arrays as JSON text in a single cell. Values that start with =, + or @ get a leading apostrophe so a spreadsheet does not execute them as formulas. In the other direction, paste CSV with a header row: the delimiter is detected, quoted fields with commas and line breaks are handled, numbers and true/false can be typed, and address.city headers become nested objects again. For writing the queries that produce this data, try the SQL query builder or the Excel formula generator.
Tips for working with JSON every day
- Validate before you debug. Half of "the API is broken" tickets are a missing comma in a request body.
- Sort keys before you compare two documents. Diff tools then show real changes instead of reordered fields.
- Minify for transport, format for people. Whitespace has no meaning in JSON, so both versions hold the same data.
- Keep secrets out of shared formatters. Online tools that upload your data are a risk for tokens and personal data; this one does not upload anything.
More free tools for developers and teams are on the free AI generators and tools page, including a test case generator for the code that consumes your JSON.
FAQ
Is this JSON formatter free and private?
Yes. It is free with no sign-up and no limit. Formatting, validation and conversion run in your browser with plain JavaScript, so your JSON is never uploaded, logged or stored on a server.
What is the difference between a JSON formatter and a JSON validator?
A formatter (or beautifier) adds indentation and line breaks so JSON is easy to read. A validator checks that the text follows the JSON rules and reports the first error. This tool does both at the same time and gives the exact line and column of any error.
Why does my JSON fail with a trailing comma or single quotes?
JSON is stricter than JavaScript. It does not allow a comma after the last item, single-quoted strings, unquoted keys or comments. Use the Fix common mistakes button to repair these automatically, then review the changes.
Does the formatter change my numbers or key order?
No. Numbers are kept exactly as written, even IDs larger than JavaScript can store, and keys keep their original order unless you turn on Sort keys A-Z.
Which JSON Schema version is supported?
The tool validates the core of JSON Schema draft 2020-12, including types, required, properties, enum, string and number limits, formats, items, prefixItems, allOf, anyOf, oneOf, not, if/then/else and local $ref. Keywords it does not evaluate are listed instead of being silently ignored.