Single quotes in JSON

In JSON, every string, keys included, goes in double quotes. RFC 8259 defines a string as text between two " characters, and ' can't start a value. JavaScript and Python both accept single quotes, and Python prints dictionaries with them, so this JSON usually comes from code or from printing a Python dict.

In Chrome and Node.js, JSON.parse says: Expected property name or '}' in JSON

Broken
{
  'name': 'Ada Lovelace',
  'quote': 'It\'s "the Analytical Engine"'
}
Fixed
{
  "name": "Ada Lovelace",
  "quote": "It's \"the Analytical Engine\""
}

Fix it by hand

Change each ' around keys and text to ". A " inside the text then needs a backslash (\"), and \' becomes a plain '.

Open this example in j2n