Verystep Guides Verystep Guides

How to Format, Validate and Fix Broken JSON

Broken JSON rarely needs a rewrite. It needs one comma found, in the right order, without breaking anything else.

Published November 15, 2026 - A Verystep guide

Illustration of a document filled with bracket shapes, one mismatched pair highlighted, with a wrench beside it

Paste the broken JSON in, hit Format, and read where it stops. That position — usually just after the real mistake — tells you where to look. Then work the short list of usual culprits in order: a trailing comma, single quotes, an unquoted key, a stray comment, a bracket that doesn't match. Fix one thing, format again, watch the error move. When it validates clean, give the output one read to be sure no value changed, then copy it out formatted or minify it for the job at hand. That's the whole workflow. No reinstalling anything. No guessing.

Format, fix, validate — in that order

Don't fix blind. Paste first, format second, and let the tool point. Nine times out of ten it points well. The steps below are the loop I run every time, whether the file came from an API, a config someone hand-edited, or a spreadsheet export that went sideways. If the structure itself is what's tripping you up, the JSON without tears guide covers that side — this page stays on the fixing workflow.

  1. Paste your JSON into the tool — it stays in your browser and nothing's uploaded to a server.
  2. Click Format and watch where it stops or what it flags, because the reported position is your first clue.
  3. Read the error position and look just before it, since most errors point at the character after the real problem.
  4. Fix the usual culprits in order: trailing comma, single quotes, unquoted keys, comments, then mismatched brackets.
  5. Format again after each single fix so a new error position tells you if you actually moved forward.
  6. Once it validates clean, scan the formatted output once to be sure no value changed while you edited.
  7. Copy the formatted version out, or minify it if the file needs to go into a request or a config that wants it compact.

Work in the browser and your data stays put. The tool doesn't upload your paste anywhere, so you can drop in a config with real values and fix it where it sits. Still — don't paste live passwords or keys into any tool out of habit. Redact first if you're sharing a screenshot of the error with someone else.

Read the error position like a clue, not a verdict

Say the tool flags position 142. Don't stare at character 142. Look just before it.

Parsers complain when they trip, and they trip on the character after the thing they couldn't swallow. A missing comma at the end of the line above? The error lands on the next key. An extra comma before a closing bracket? The error lands on the bracket. So read backwards from the flag, a few characters at a time, and ask what the parser just ate. That one habit turns a wall of red text into a short search.

Magnifier pinpointing a single spot among rows of bracket shapes
The flag marks where the parser stopped. The mistake usually sits just before it.

Worked example, the classic one. An export gives you a name and a city on separate lines, and the tool stops right at the start of the city line. You look up. The name line ends with no comma. Add it, format again, done. Thirty seconds — once you stop reading the error as the bug is here and start reading it as the bug is just behind here.

The usual culprits, in the order to check them

Don't hunt randomly. Go down this list, top to bottom. The first three fix most files I see.

Trailing comma first. It's the last value in a list or an object, followed by a comma and then the closing bracket. Plenty of languages allow it. JSON doesn't. Delete that comma and re-format before you touch anything else — half the time you're already done.

Single quotes next. JSON wants double quotes around keys and around text values. A file touched by hand, or pasted out of a code snippet, often arrives wearing single quotes instead. Swap them for double quotes. Careful with apostrophes inside the text itself, though — a name with an apostrophe in it will fight a blanket replace, and that's a sign to fix that one value by hand rather than swapping every quote in the file.

Unquoted keys after that. In code you can write a key bare and it works. In JSON you can't — every key needs its double quotes. Exports from logging tools do this a lot, and so do hand-written configs. Quote the keys, leave the numbers and the true, false and null values bare, and format again.

Comments come fourth. If someone left themselves a note inside the file — a line starting with two slashes, or a note wrapped in slash-star markers — the parser will choke on it, because JSON has no comments at all. Move the note outside the file, into your docs or your commit message, and delete it from the data.

Mismatched brackets last, because they're the fiddliest. Count in pairs from the outside in, or lean on the formatted indentation once the earlier fixes land — a section that suddenly indents wrong is usually the section missing its closer. Add or remove one bracket, then format again. One change at a time. If you fix three things at once and it still fails, you won't know which fix helped and which one hurt.

Finish clean: validate, read it once, copy it out

Clean validation isn't quite the finish line. Read the formatted output once, top to bottom, and spot-check two or three values you know by heart — a total, a name, a date. Edits made while hunting commas can quietly eat a digit. It happens. A ten-second read catches it; a production import catches it louder.

Then take the version your next step actually wants. Sending the data to a person or saving it as a working file? Keep the formatted version — the next human will thank you. Feeding it into a request body or a config that wants it compact? Minify it, which strips the spacing back out without touching the values. Either way, copy from the validated output, not from your original paste. Your original paste is the broken one. Obvious, yes. Still the mistake people make at 6 p.m. on a Friday.

Format and validate your JSON now

The Verystep JSON tool formats, validates and minifies in your browser. Paste your JSON, let it flag the error position, fix one culprit at a time, and copy out a clean formatted or minified version. Nothing you paste is uploaded.

Open the JSON Formatter & Validator ->

Last verified November 15, 2026 — workflow checked against the live Verystep JSON tool (in-browser format, validate and minify, no upload) and the JSON data format rules in RFC 8259.

Frequently asked questions

The error position looks wrong — it points at a line that looks fine. Why?

Because the parser reports where it stopped, not where the mistake is. The real problem sits just before the flagged spot — often a missing comma or an extra comma at the end of the previous line. Read backwards from the flag and you'll find it faster than re-reading the whole file.

Can I just fix everything at once?

You can. You shouldn't. Fix one culprit, format again, and watch whether the error moves or clears. If you change five things and it still fails, you've got no idea which change mattered. One at a time feels slower. It isn't — it's how you avoid going in circles.

Is my JSON uploaded when I paste it here?

No. The tool runs in your browser, so your paste stays on your device and nothing's sent to a server. That's handy for configs and exports with real values in them. Still, get out of the habit of pasting live passwords or private keys into any tool, anywhere.

What's the difference between formatting and minifying?

Formatting spreads the data out with indentation so humans can read it and spot mistakes. Minifying does the opposite — it removes the spacing and packs everything into as little room as possible, without changing any values. Format to fix and review. Minify for the final copy when a system wants it compact.

My file still won't validate after all five fixes. Now what?

Copy the flagged section into a fresh paste on its own and format just that. A small chunk is far easier to eyeball, and you'll often spot a stray character — a smart quote pasted from a document, a hidden space — that the full file was hiding. If the chunk validates, paste it back and work outward.

More guides