Malformed JSON is rarely mysterious. It’s usually a missing comma, a bracket that never closed, or a quote that went on an adventure. The hard part is finding the break in a long payload without losing the afternoon.
This guide covers common syntax failures, a careful repair workflow, and how to review automatic fixes - without promising that any tool can repair every possible string that almost looks like JSON.
What “malformed” usually means
JSON has a small set of structural rules. When something breaks, parsers fail fast. Typical culprits:
| Issue | What it looks like | Why it breaks |
|---|---|---|
| Missing comma | Two properties back-to-back | Parser expects , or } |
| Trailing comma | Extra , before } or ] |
Strict JSON disallows it |
| Mismatched brackets | { closed with ] (or the reverse) |
Structure no longer balances |
| Unquoted keys | { status: "ok" } |
Keys must be double-quoted strings |
| Broken strings | "note": "He said "hi"" |
Unescaped quotes end the string early |
| Incomplete values | "count": with nothing after |
Value required after : |
These are syntax problems. Fixing them is not the same as validating a schema, decoding a JWT, or converting JSON to XML/CSV.
If you’re still sorting terms like formatter vs validator, read JSON formatter vs beautifier vs validator.
A missing comma, demonstrated
Broken sample (fictional):
{
"request_id": "demo_1042",
"status": "needs_review"
"customer": {
"name": "Example Company"
},
"api_key": "sample_key_not_real",
"debug_note": "Sample data only"
}
There’s no comma after "needs_review". Many formatters will refuse to pretty-print until the syntax is valid - which is why searches like json formatter not working often lead back to a parse error, not a broken pretty-printer.
Repaired sample:
{
"request_id": "demo_1042",
"status": "needs_review",
"customer": {
"name": "Example Company"
},
"api_key": "sample_key_not_real",
"debug_note": "Sample data only"
}
One character. Several unnecessary sighs. That’s the genre of bug repair tools are built for.
A practical repair workflow
1. Confirm it’s a syntax problem
If a library or API says “Unexpected token” or “Expected ',' or '}'”, you’re in syntax territory. If the JSON parses but the values are wrong, repair won’t help - you need application debugging.
2. Work on a copy
Keep the original payload. Automatic repair infers structure; inference can be wrong on ambiguous input. You’re reviewing a suggestion, not receiving gospel.
3. Apply common repairs - then read the repair list
Pretty Payload can help with common JSON syntax issues (missing commas, quotes, brackets, and other supported problems). When a repair runs, use View repairs (or the equivalent notice) and read what changed.
Good habits:
- Skim every listed change
- Check nearby keys for accidental merges or splits
- Re-validate by parsing again after edits
4. Format, then search
Once it parses, pretty-print or open a tree view so you can find the field that actually matters. A collapsible viewer beats scrolling minified text. See Free online JSON viewer & formatter.
5. Don’t over-trust “fix JSON” marketing
Be wary of promises to fix any JSON instantly. Ambiguous fragments, partial logs, and mixed text+JSON dumps may need human judgment. Use automatic repair for common syntax issues, then review the result.
Other fixes you’ll meet in the wild
Brackets and braces
{
"items": [
{ "sku": "DEMO-01", "quantity": 2 }
)
}
That closing ) should be ]. Balance errors are easy to introduce when editing by hand in a long file.
Quotes inside strings
{
"message": "User said "approve" in the ticket"
}
Escape inner quotes:
{
"message": "User said \"approve\" in the ticket"
}
Or restructure the value if escaping gets noisy.
JSON-looking text that isn’t JSON
Log lines, trailing comments (//), or single-quoted strings from another language will fail strict parsers. Repair engines vary in what they attempt. If the input isn’t mostly JSON, extract the JSON object first, then repair.
Nested JSON strings
Sometimes the outer document is valid, but a string field contains escaped JSON. That’s not “malformed” - it’s nested. Expand and inspect it separately: Nested JSON viewer.
Validate online without turning repair into a black box
Validate JSON online should mean: paste, learn whether it parses, and see useful error context when it doesn’t.
Pretty Payload’s web demo lets you try formatting and repairs in the browser. Processing runs locally; inspected payloads are not uploaded for processing.
Review repairs every time - especially when the payload includes anything sensitive. Local processing reduces upload risk for inspected content; it does not replace careful handling on your side.
When repair isn’t the right tool
Skip automatic repair when:
- You need a byte-identical artifact for a signature or checksum
- The “JSON” is actually a custom format
- You’re debugging why a producer emitted bad output (fixing may hide the root cause)
- You need schema validation or cross-format conversion, which requires a different tool
In those cases, isolate a minimal fictional reproduction, fix deliberately, and keep the broken original for the ticket.
Privacy while you fix things
Broken payloads still contain real data in production incidents. Prefer tools that process JSON locally in the browser and do not upload inspected payloads for processing.
Pretty Payload runs inspection and repair locally. The extension can keep recent documents in local history; you can clear history or turn it off in settings. Review the privacy policy and your organization’s requirements before using any tool with sensitive data.
For daily clipboard repair, the Chrome extension offers 10 free opens (no signup), then a 30-day email trial with no card. The demo stays free without signup for quick checks.
FAQ
Why won’t my JSON formatter work?
Often the input isn’t valid JSON yet. Formatters that parse first will fail on missing commas, bad quotes, or unbalanced brackets. Fix or repair syntax, then format.
Can Pretty Payload fix any JSON?
No - and you shouldn’t trust any tool that says it can. Pretty Payload repairs common syntax issues and shows what changed so you can review.
Is a trailing comma invalid?
In strict JSON, yes. Some languages and config formats allow trailing commas; JSON does not. Repair or remove the extra comma before parsing as JSON.
Should I repair production payloads automatically in a pipeline?
Be careful. Silent repair can hide producer bugs and change meaning. Prefer failing loudly in CI, and use interactive repair when you’re inspecting a one-off payload.
Where can I try repairs on sample data?
Open the free web demo, paste a deliberately broken sample (missing comma is a classic), and review the repair details before copying the result.
Next step
Malformed JSON is usually a small structural mistake with a large annoyance budget. Repair the common cases, review the repair details, then get back to the real bug.
See how repairs work: try the web demo.
For repeated clipboard workflows, add Pretty Payload to Chrome.