1. Single quotes around keys or strings
{'name': 'my-app'} is a valid JavaScript object and valid Python, but JSON only accepts double quotes. Copying an object out of code or a Python print is the usual way this happens.
JavaScript, from JSON.parse()
Right after a { the parser needs either a double-quoted key or a closing }. Anything else stops it, which means the text is a JavaScript object literal or a JSON-like config, and strict JSON needs every key in double quotes.
A JavaScript object pasted as JSON. Press Repair to quote the keys, swap the quotes and drop the comment.
{
// copied from a JavaScript file
name: 'my-app',
'version': '1.4.0',
private: true,
}
{'name': 'my-app'} is a valid JavaScript object and valid Python, but JSON only accepts double quotes. Copying an object out of code or a Python print is the usual way this happens.
{name: "my-app"} works in JavaScript and not in JSON, where every key must be a double-quoted string.
JSON has no comments, so // and /* */ lines make the parser stop at the slash. tsconfig.json and VS Code settings are JSONC and allow comments, which is why copying from them causes this. Strip the comments or press Repair.
No. JSON strings and keys must use double quotes. Single quotes are a JavaScript and Python convention that JSON never adopted.
In code, JSON.stringify(object) gives you valid JSON. If you only have the text, paste it into the editor above and press Repair, it quotes the keys, converts single quotes and removes comments and trailing commas.