Missing comma
{
"name": "Anna"
"age": 31
}{
"name": "Anna",
"age": 31
}Two entries need a comma between them. It often goes missing when single lines are copied around.
Paste JSON, format it, validate it. The tool pinpoints errors by line and column and can repair them for you.
The result appears here.
More than 50 MB, many files at once, or an API? That is what Pro is for. See Pro
A JSON formatter turns one long, squashed line of JSON into neatly indented text that people can read. It also checks whether the JSON is valid and shows the exact spot where it breaks.
JSON stands for JavaScript Object Notation. It is a text format programs use to exchange data: an app asks a server, the server answers in JSON. The format is defined in RFC 8259 and ECMA-404.
JSON has exactly six kinds of values: strings in double quotes, numbers, true and false, null, arrays in square brackets and objects in curly braces. An object is a set of key and value pairs. That is all there is, which is exactly why JSON is everywhere.
Nearly every broken JSON document fails on one of these six points. Auto-fix handles all six.
{
"name": "Anna"
"age": 31
}{
"name": "Anna",
"age": 31
}Two entries need a comma between them. It often goes missing when single lines are copied around.
{ "tags": ["a", "b",], }{ "tags": ["a", "b"] }No comma is allowed after the last entry. JavaScript forgives it, JSON does not.
{ 'name': 'Anna' }{ "name": "Anna" }Keys and strings need double quotes. Python prints dictionaries with single quotes, and that is not JSON.
{ name: "Anna" }{ "name": "Anna" }JavaScript lets you drop the quotes around a key. JSON never does.
{
// user id
"id": 7
}{
"id": 7
}JSON has no comments. If you need them, use JSONC or YAML, or add a field such as "_note".
{ "ratio": NaN, "next": undefined }{ "ratio": null, "next": null }These values only exist in JavaScript. In JSON, null takes their place.
All three describe nested data. JSON is the default for APIs, YAML for configuration files that people maintain by hand, and XML wherever documents, namespaces or legacy systems are involved.
| JSON | YAML | XML | |
|---|---|---|---|
| Typical use | APIs, data exchange | Configuration (Docker, Kubernetes, CI) | Documents, feeds, legacy interfaces |
| Comments | no | yes | yes |
| Readability | good once formatted | very good, but indentation matters | verbose because of tags |
| Data types | six fixed types | like JSON plus dates and more | everything is text, types only via a schema |
| Typical mistakes | commas and quotes | indentation, "no" turning into false | forgotten closing tags |
No. Formatting, validating and converting all run in your browser. There is no upload and no server log of your content. You can verify it yourself: load the page, go offline, keep working.
Up to 50 MB for free. A web worker does the work in the background, so the page stays responsive. Only the visible lines are rendered, which is why even millions of lines scroll smoothly.
Missing and trailing commas, single and curly quotes, unquoted keys, comments, NaN and undefined, Python spellings such as True and None, missing closing brackets, Markdown code fences and JSONP wrappers. Every change is listed before you apply it.
Open the file and press Shift + Alt + F (Mac: Shift + Option + F). VS Code refuses when the JSON is invalid, though. In that case paste it here to see what is wrong.
With jq: jq . file.json. Without jq, python3 -m json.tool file.json works too. Both stop at the first error and repair nothing.
Formatting adds line breaks and indentation so people can read the JSON. Minifying removes them again so the file gets smaller. The content is identical either way.
Invisible characters are a frequent cause: a BOM at the start of the file, a non-breaking space, or curly quotes pasted from Word or a chat window. The tool reports and removes them.
Yes, with "Share link". The content is compressed and written into the part of the link after the #. Browsers never send that part to a server. It works up to roughly 64 KB.
Click the row in the tree view and choose "Copy path". You get a path such as data.items[3].name that you can drop straight into JavaScript or jq.