JSON Syntax Error Guide

How to Fix 'JSON keys must be double-quoted' Syntax Errors

SyntaxError: Expected property name or '}' in JSON

Why This Error Happens

In standard JSON, all object property keys must be enclosed in double quotation marks ("). Using single quotes (') or leaving keys unquoted (like in JS objects) violates RFC 8259.

Developers accustomed to JavaScript or TypeScript frequently write unquoted keys or single quotes. Standard JSON parsers strictly reject unquoted names and single-quoted strings.

Invalid / Broken JSON
{
  name: 'Anil',
  role: 'Developer'
}
Fixed / Valid JSON
{
  "name": "Anil",
  "role": "Developer"
}

Step-by-Step Fix

  • 1Replace single quotes (') with double quotes (").
  • 2Enclose all property names in double quotes.
  • 3Use our JSON Formatter / Validator to auto-quote all property keys in one click.

Test and Auto-Fix Broken JSON Online

Paste your raw payload into our free, client-side JSON Validator. Detect syntax errors with line numbers and fix them in one click.

Open Free JSON Validator

Frequently Asked Questions

Can I use single quotes for string values in JSON?

No. All strings and keys in valid JSON must use double quotes ("). Single quotes (') are illegal in standard JSON.

How can I convert JavaScript objects with unquoted keys to JSON?

In JavaScript, use JSON.stringify(obj). If you have raw text, paste it into our JSON Validator and click 'Fix with AI' to instantly format it to valid JSON.

Other Common JSON Errors