JSON Repair & Validator

Paste invalid JSON, SyntaxError logs, or JS-style literals on the left. Validate checks syntax without rewriting; Repair fixes trailing commas, comments, and bad quotes, with green diff highlights. Copy strict JSON, then open the JSON formatter to pretty-print or convert. Click output to copy.

About this JSON Repair & Validator

Paste broken JSON from API logs, CI configs, or half-copied responses—click Validate to check syntax without changing your text, or Repair to produce standard JSON you can copy.

Repair handles trailing commas, // comments, single quotes, unquoted keys, and sometimes missing closing brackets, then pretty-prints with 2-space indent. Green marks on the right show what changed compared to your original paste.

JSON validation & repair essentials

Why trailing commas break JSON.parse

Strict JSON (RFC 8259) forbids a comma after the last item in an object or array. Many editors and JS configs allow trailing commas, but JSON.parse, CI linters, and Validate on this page will fail. Repair removes those commas and outputs parseable strict JSON.

What is not standard JSON

  1. Keys and string values must use double quotes—not single quotes.
  2. No // line comments or /* */ block comments.
  3. No trailing comma after the last property or array element; unquoted object keys are invalid.
  4. Console object literals and JSON5-style paste often need Repair before Postman, strict APIs, or the JSON formatter.

Unexpected token and SyntaxError

These errors usually point near an extra comma, a missing quote, or mismatched brackets. Click Validate for an approximate line and column under the input, then check that line for comments, trailing commas, or single quotes. Repair normalizes quotes and strips comments and trailing commas; badly truncated text may still fail and need manual edits.

Validate vs Repair

Validate is a syntax check only—it does not rewrite your paste. Repair rewrites into strict JSON and marks changes in green on the right. After a successful repair, use Open JSON formatter for tree view, minify, or XML/YAML conversion. Processing stays in your browser; nothing is uploaded.

Typical search scenarios

Unexpected token in CI or config

Paste the failing fragment, click Repair, and use green highlights to spot removed trailing commas or comments before you commit the fixed block.

Half-copied API response

Validate points to the rough line/column; Repair tries to close brackets and normalize quotes. Review highlights before using in production.

JavaScript-style object literal

Single-quoted strings and unquoted keys from devtools are not standard JSON—Repair converts them for request bodies and API examples.

Frequently asked questions

How do I validate JSON syntax online?
Paste your text on the left and click Validate. The page runs JSON.parse—if it passes, you see formatted output on the right; if not, an error under the input with an approximate line and column. Your original paste is not rewritten.
Does online JSON syntax check change my text?
Validate does not change the left input—it only reports valid or invalid and may show formatted output on the right when valid. Click Repair only when you want auto-fix and green diff highlights on a rewritten strict JSON result.
How to fix JSON with a trailing comma online?
Paste the object or array (for example {"a":1,}), click Repair, and copy strict JSON from the output. Green marks show removed commas or other edits. Use Validate first if you only need pass/fail without rewriting.
Unexpected token or SyntaxError when pasting JSON—what now?
Usually trailing commas, // comments, single quotes, or unquoted keys. Validate locates the rough line/column; Repair strips comments and trailing commas and normalizes quotes. JSON5-only features are not kept in output.
Can I repair JSON with comments online?
Click Repair on text with // or block comments. Output is strict JSON without comments, because the JSON spec does not allow them. Use Validate if you only want to know whether the text parses, without rewriting.
How to convert JSON5 to standard JSON online?
Paste JSON5-style text (comments, trailing commas, unquoted keys, single quotes) and click Repair. The result is strict JSON for APIs and JSON.parse—not a JSON5 editor, and JSON5-only syntax is dropped. Then open the JSON formatter to pretty-print or minify.
What does green highlighting mean after repair?
Green is a character-level diff: it marks parts of the repaired output that differ from your original paste. Unmarked text matched at the text level—review highlights before copying into production configs.
Can truncated or incomplete JSON be auto-fixed?
Repair sometimes guesses missing closing brackets—always verify with highlights and meaning. Severely cut logs or non-JSON prose may stay unrepairable; Validate still helps with line/column hints.
How do I pretty-print or minify after repairing JSON?
After Repair, click Open JSON formatter (or go to JSON formatter) with valid JSON. This page fixes syntax; the formatter adds tree view, minify, and XML/YAML/TypeScript conversion. To compare before and after, use JSON diff.

Common broken patterns

  • {"a":1,}Trailing comma before } — typical Repair fix
  • {key:'value'}Single quotes and bare keys → standard JSON
  • // note\n{"x":1}Line comments stripped, object kept
  • Validate onlyPass/fail check with no rewrite