Skip to main content

JSONL Error Dictionary

Every JSON parsing error explained in plain English with before-and-after fixes. Stop guessing - find your error, understand the cause, and fix it in seconds.

1

Trailing Comma

#trailing-comma

What your parser says:

Expected double-quoted property name in JSON at position 32

In Plain English

You have an extra comma after the last property in an object or the last item in an array. JavaScript allows trailing commas, but JSON does not. The parser reaches the comma, expects another value, and finds a closing bracket instead.

Before (Invalid)

{"name":"Alice","age":30,}

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Copying JSON from JavaScript source code where trailing commas are valid
  • Deleting a property but leaving its comma behind
  • Code generators or templates that add a comma after every item including the last
  • Editing JSON by hand and forgetting to clean up
2

Unquoted Property Names

#unquoted-keys

What your parser says:

Expected property name or '}' in JSON at position 1

In Plain English

JSON requires all property names (keys) to be wrapped in double quotes. Unlike JavaScript objects, you cannot use bare identifiers as keys. The parser sees a letter where it expects a quote character.

Before (Invalid)

{name:"Alice",age:30}

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Writing JavaScript object literal syntax instead of JSON
  • Using Python dict output without json.dumps()
  • Hand-editing JSON and forgetting quotes around keys
  • YAML-to-JSON conversion that did not quote keys
3

Single Quotes Instead of Double

#single-quotes

What your parser says:

Unexpected token ' in JSON at position 1

In Plain English

JSON only allows double quotes (") for strings. Single quotes (') are not valid in JSON, even though they work in JavaScript and Python. Every string - both keys and values - must use double quotes.

Before (Invalid)

{'name':'Alice','age':30}

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Using Python's str() or repr() on a dict instead of json.dumps()
  • Copying from a JavaScript console that displays objects with single quotes
  • Hand-writing JSON with a habit of using single quotes
  • Template engines that output single-quoted strings
4

Unexpected End of JSON Input

#incomplete-json

What your parser says:

Unexpected end of JSON input

In Plain English

The JSON string ends before the parser found everything it expected. Usually this means a missing closing brace }, bracket ], or quote ". The parser ran out of characters while still inside a structure.

Before (Invalid)

{"name":"Alice","age":30

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Truncated data from a network timeout or interrupted download
  • Missing closing brace or bracket after the last property
  • Multi-line JSON spread across multiple lines in a JSONL file
  • Buffer size limit cutting off the line mid-value
5

Unterminated String

#unterminated-string

What your parser says:

Unterminated string in JSON at position 8

In Plain English

A string value was opened with a double quote but never closed. The parser reached the end of the line (or the end of the input) while still inside a string. This usually means a missing closing quote or an unescaped quote inside the string.

Before (Invalid)

{"name":"Alice, "age":30}

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Missing closing double quote on a string value
  • Unescaped double quote inside a string value (use \")
  • Newline character inside a string (must use \n instead)
  • String contains a tab character that was not escaped as \t
6

Unescaped Control Characters

#bad-control-character

What your parser says:

Bad control character in string literal in JSON at position 15

In Plain English

There is an invisible control character (like a tab, newline, or backspace) inside a JSON string that has not been properly escaped. JSON requires these characters to use escape sequences like \n, \t, or \uXXXX.

Before (Invalid)

{"bio":"Line one[TAB]Line two"}

After (Valid)

{"bio":"Line one\tLine two"}

Common Causes

  • Tab characters pasted from a spreadsheet or text editor
  • Literal newlines inside a JSON string value (use \n instead)
  • Form feed, backspace, or null bytes from binary data
  • Data copied from PDFs or word processors containing hidden characters
7

Invalid Token at Position 0

#invalid-token

What your parser says:

Unexpected token u in JSON at position 0

In Plain English

The very first character of the line is not valid JSON. JSON values must start with {, [, ", a digit, or one of the literals true, false, null. The parser found something completely unexpected at the start.

Before (Invalid)

undefined

After (Valid)

{"status":"ok"}

Common Causes

  • Trying to parse undefined or an empty string
  • A BOM character at the start of the file (see BOM Character)
  • HTML error page returned instead of JSON data
  • Server returned a plain text error message instead of JSON
8

Duplicate Keys in Object

#duplicate-keys

What your parser says:

Duplicate key "name" (may silently overwrite - behavior varies by parser)

In Plain English

The same key name appears more than once in a single JSON object. While technically allowed by the JSON spec, it causes unpredictable behavior. Most parsers silently use the last value, but some use the first or throw an error. This is almost always a mistake.

Before (Problematic)

{"name":"Alice","age":30,"name":"Bob"}

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Merging two JSON objects by concatenation instead of proper merge
  • Copy-paste errors when editing JSON by hand
  • Code generator producing the same field twice
  • Different code paths both writing the same key to a dictionary
9

BOM (Byte Order Mark) at Start

#bom-character

What your parser says:

Unexpected token <U+FEFF> in JSON at position 0

In Plain English

The file starts with an invisible character called a Byte Order Mark (BOM, U+FEFF). This 3-byte sequence (EF BB BF in UTF-8) is added by some text editors like Windows Notepad to mark the file encoding. JSON parsers do not expect it and fail on the very first character.

Before (Invalid)

[BOM]{"name":"Alice","age":30}

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • File saved with Windows Notepad (adds BOM by default in older versions)
  • Excel or other Microsoft tools exporting to CSV/text with BOM
  • PHP files that include a BOM before JSON output
  • Concatenating files where one has a BOM header
10

Inconsistent CR/LF Line Endings

#mixed-line-endings

What your parser says:

Unexpected token \r in JSON at position 28

In Plain English

Your JSONL file has a mix of Windows-style (\r\n) and Unix-style (\n) line endings. Some parsers that split on \n will leave a stray carriage return (\r) at the end of each line, causing a parse error on what looks like perfectly valid JSON.

Before (Problematic)

{"name":"Alice"}\r\n
{"name":"Bob"}\n

After (Valid)

{"name":"Alice"}\n
{"name":"Bob"}\n

Common Causes

  • File edited on both Windows and macOS/Linux without normalizing line endings
  • Git autocrlf settings converting line endings inconsistently
  • Appending data from different operating systems to the same file
  • FTP transfer in ASCII mode corrupting line endings
11

Array Brackets vs Object Braces Confusion

#wrong-brackets

What your parser says:

Expected ',' or ']' in JSON at position 6

In Plain English

You used square brackets [ ] where curly braces { } were needed, or the other way around. Arrays use brackets and hold ordered values. Objects use braces and hold key-value pairs. Mixing them up causes the parser to expect the wrong kind of content.

Before (Invalid)

["name":"Alice","age":30]

After (Valid)

{"name":"Alice","age":30}

Common Causes

  • Wrapping a JSONL file in array brackets (JSONL records are standalone, not array items)
  • Confusing JSON array format with JSONL format
  • Mismatched opening and closing brackets after manual editing
  • Starting an object with [ instead of {
12

Leading Zeros in Numbers

#leading-zeros

What your parser says:

Unexpected number in JSON at position 7

In Plain English

JSON does not allow numbers with leading zeros like 007 or 01.5. The only number that can start with zero is 0 itself (and decimals like 0.5). Leading zeros are ambiguous because some languages treat them as octal notation.

Before (Invalid)

{"id":007,"score":09}

After (Valid)

{"id":7,"score":9}

Common Causes

  • Zero-padded IDs exported from databases (e.g., employee ID "007")
  • Zip codes or phone numbers stored as numbers instead of strings
  • Formatting numbers with leading zeros for display alignment
  • Octal notation from C-like languages leaking into JSON output
13

Unexpected Number in JSON

#unexpected-number

What your parser says:

Unexpected number in JSON at position 12

In Plain English

A number appeared where the parser did not expect one. This usually means a missing comma between values, a colon missing between a key and value, or a number used where a string key was expected. The parser found digits where it needed punctuation or a quoted string.

Before (Invalid)

{"age":30 50}

After (Valid)

{"age":30,"score":50}

Common Causes

  • Missing comma between two key-value pairs
  • Missing colon between a key and its numeric value
  • Two numbers next to each other in an array without a comma
  • Leading zeros causing the parser to see two separate numbers (see Leading Zeros)
14

Unexpected String in JSON

#unexpected-string

What your parser says:

Unexpected string in JSON at position 18

In Plain English

A quoted string appeared where the parser did not expect one. This usually means a missing comma between two values, or two string values placed next to each other without proper separation. The parser found a quote character where it expected a comma, colon, or closing bracket.

Before (Invalid)

{"name":"Alice" "age":"30"}

After (Valid)

{"name":"Alice","age":"30"}

Common Causes

  • Missing comma between two key-value pairs
  • Concatenating two JSON objects without a comma separator
  • Missing colon between a key and its string value
  • Extra closing quote causing the parser to end a string early

Quick Reference

ErrorQuick Fix
Trailing CommaRemove the comma before the closing } or ]
Unquoted KeysWrap all property names in double quotes
Single QuotesReplace all single quotes with double quotes
Incomplete JSONAdd the missing closing } or ]
Unterminated StringAdd the missing closing double quote
Control CharactersEscape tabs as \t and newlines as \n
Invalid TokenEnsure the line starts with valid JSON ({, [, ")
Duplicate KeysRemove or rename one of the duplicate keys
BOM CharacterRe-save the file as UTF-8 without BOM
Mixed Line EndingsNormalize all line endings to LF (\n)
Wrong BracketsUse { } for objects and [ ] for arrays
Leading ZerosRemove leading zeros or use strings for zero-padded IDs
Unexpected NumberAdd the missing comma or colon before the number
Unexpected StringAdd the missing comma or colon before the string

Ready to Fix Your JSONL?

Paste your data into the validator and get instant error detection with line numbers, auto-fix suggestions, and downloadable results.

Open the JSONL Validator