Learn JSON
Short guides to how JSON works, and how to fix the errors people run into most.
Start here
- What is JSON?
What JSON is for, the six kinds of value, and the rules that trip people up.
Basics
- JSON vs. JavaScript objects
Why an object that works in JavaScript can fail as JSON, and how to convert between the two.
- Strings and escaping in JSON
Double quotes, backslash escapes like
\n, and the characters that must be escaped. - Numbers and precision in JSON
Why big IDs can lose digits, and why
0.1 + 0.2isn't0.3.
Fix an error
Each one shows what Chrome and Node.js say, so you can match the message you got.
- Trailing comma in JSONYou left a comma after the last item
Expected double-quoted property name in JSON - Unexpected end of JSON inputThe JSON got cut off partway, or the text is empty
Unexpected end of JSON input - Missing comma in JSONTwo items have no comma between them
Expected ',' or '}' after property value in JSON - Single quotes in JSONKeys or text are in 'single quotes'
Expected property name or '}' in JSON - Unquoted keys in JSONA key has no quotes around it
Expected property name or '}' in JSON - Text before or after the JSONOther text or Markdown fences came along with the JSON
Unexpected token 'H' - Missing curly braces in JSONYou copied a few keys and values without the { } around them
Unexpected non-whitespace character after JSON at position 6 - Missing square brackets in JSONSeveral values with commas, but no [ ] around them
Unexpected non-whitespace character after JSON at position 33 - Comments in JSONThe JSON has // or /* */ comments in it
Expected property name or '}' in JSON - True, False and None in JSONIt uses Python's True, False or None
Unexpected token 'T' - Curly quotes in JSONThe quotes are curly “ ” instead of straight
Expected property name or '}' in JSON - Unterminated string in JSONA string is missing its closing quote
Bad control character in string literal in JSON - Line break inside a JSON stringA string has a real line break in it
Bad control character in string literal in JSON - Missing colon in JSONA key has no colon before its value
Expected ':' after property name in JSON - JSON inside JavaScript or Python codeThe JSON is still inside JavaScript or Python code
Unexpected token 'c' - JSON inside a curl commandThe JSON is still inside a curl command
Unexpected token 'c'
JSON in n8n
- JSON in n8n
How nodes pass data as items, what the
jsonandbinarykeys hold, pinned data, and workflow JSON.