FileExamples
ErrorJSON · .json

JSON Single Quotes — Invalid String Delimiters

A JSON file using single quotes instead of double quotes for strings. This is valid JavaScript syntax but violates the JSON specification.

Why It Fails

JSON requires all strings to be enclosed in double quotes ("). Single quotes are not part of the JSON grammar. This commonly occurs when developers copy JavaScript object literals into JSON files.

Broken Example

{
  'name': 'Alice',
  'city': 'New York'
}

Expected Error Behavior

JSON.parse() throws SyntaxError: Unexpected token ' in JSON. Most APIs return 400 Bad Request when receiving single-quoted JSON.

Affected Software

JSON.parse()All strict JSON parsersREST APIsGraphQL endpoints

How to Fix

Replace all single quotes with double quotes. Use JSON.stringify() to generate valid JSON from JavaScript objects.