Input
Waiting for input
1
Output
1
Paste the JSON that is throwing the error. We highlight the exact character position, explain what JSON.parse expected, and one-click repair the most common causes.
Runs entirely in your browser — no upload, no wait.
Your JSON never leaves the tab. Nothing is logged.
Free, unlimited, no account required.
When JSON.parse reads your string, it walks character by character expecting a specific grammar: an object opens with a brace, every key is a double-quoted string, every value is one of the seven JSON types, and so on. The moment it sees a character that does not fit, it throws — and the position number is the byte offset where the parser gave up.
The message is generic on purpose. The same error can mean a missing quote, a stray comment, a Python-style True, a NaN, a single quote, or an actual control character. The fixer tells you which.
1. Single quotes instead of double quotes — copied from JavaScript or Python. 2. Unquoted keys — `{name: "Ada"}` is JS, not JSON. 3. Trailing commas at the end of arrays or objects. 4. Comments (// or /* */) — JSON has no comments. 5. Smart quotes — pasted from Word or Slack. 6. NaN, Infinity, undefined — none of these are valid JSON values. 7. Truncated payload — the response was cut off mid-string. 8. BOM or hidden characters — invisible bytes at the start of the file.
The number after "position" is a zero-based character offset. So "Unexpected token N in JSON at position 42" means the parser failed at character 43. The editor in this tool jumps the cursor straight to that offset and highlights the surrounding line so you can see the context immediately.
try {
JSON.parse(input);
} catch (e) {
// e.message: 'Unexpected token } in JSON at position 42'
const pos = +e.message.match(/position (\d+)/)?.[1];
console.log('Failed near:', input.slice(Math.max(0, pos - 20), pos + 20));
}For most everyday issues — single quotes, trailing commas, comments, smart quotes — Smart Auto-Repair will hand you valid JSON in one click. For ambiguous cases (truncated payload, mismatched brackets) the tool surfaces the exact location and recommended fix without guessing.
All parsing and repair happens locally in your browser. No upload, no server round-trip, no telemetry on the JSON itself. Works offline once the page is loaded.