Formatter Validator Minifier Escape / Unescape JSON ↔ String JSON ↔ YAML JSON → CSV NDJSON / JSON Lines JSON → Types JSON ↔ XML JSON Diff JSON Patch Canonicalize (RFC 8785) Schema Validator Schema Generator JSONPath Tester JWT Decoder JSON Errors Schemas More Tools
JSONTools / JSON errors / Unclosed array — unexpected end of JSON input
JSON error registry · Truncated document

Unclosed array — unexpected end of JSON input

The array's closing bracket is missing, usually for the same transport or buffer reason as an unclosed object.

The input

Fails to parse
[1, 2
Parses correctly
[1, 2]

Open this broken input in the formatter →

How to fix it

Confirm the full body arrived before parsing.

Streaming writers that never flush produce exactly this shape.

What each parser reports

Every message below was captured by running this exact input through the parser named. 19 of 21 parsers rejected it; 2 accepted it.

Parser Exact message
CPython json.loads
CPython 3.12.3
Expecting ',' delimiter: line 1 column 6 (char 5)
what this message means →
encoding/json Unmarshal
Go go1.22.2
unexpected end of JSON input
what this message means →
Gson
Java 21.0.12
java.io.EOFException: End of input at line 1 column 6 path $[2]
what this message means →
Gson JsonParser (lenient off)
Java 21.0.12
java.io.EOFException: End of input at line 1 column 6 path $[2]
what this message means →
hjson
Node.js 22.22.2
End of input while parsing an array (missing ']') at line 1,5 >>>1, 2 ...
what this message means →
Jackson ObjectMapper
Java 21.0.12
Unexpected end-of-input: expected close marker for Array (start marker
what this message means →
JavaScriptCore JSON.parse
JavaScriptCore (Bun 1.4.1)
JSON Parse error: Expected ']'
what this message means →
json-bigint
Node.js 22.22.2
Expected ',' instead of ''
what this message means →
JSON5
Node.js 22.22.2
JSON5: invalid end of input at 1:6
what this message means →
JSON::PP
Perl 5.038002
, or ] expected while parsing array, at character offset 5 (before "(end of string)")
what this message means →
json_decode
PHP 8.3.6
Syntax error
Newtonsoft.Json JsonConvert
Newtonsoft.Json 13.0.3 on .NET 8.0.30
accepted — no error
Newtonsoft.Json JsonTextReader
Newtonsoft.Json 13.0.3 on .NET 8.0.30
accepted — no error
orjson
CPython 3.12.3
unexpected end of data: line 1 column 6 (char 5)
what this message means →
Ruby JSON.parse
Ruby 3.2.3
unexpected token at ''
serde_json::from_str
Rust (serde_json 1.x)
EOF while parsing a list at line 1 column 5
what this message means →
SpiderMonkey JSON.parse
SpiderMonkey 115
JSON.parse: end of data when ',' or ']' was expected at line 1 column 6 of the JSON data
what this message means →
System.Text.Json Deserialize
.NET 8.0.30
'2' is an invalid end of a number. Expected a delimiter. Path: $ | LineNumber: 0 | BytePositionInLine: 5.
what this message means →
System.Text.Json JsonDocument
.NET 8.0.30
'2' is an invalid end of a number. Expected a delimiter. LineNumber: 0 | BytePositionInLine: 5.
what this message means →
ujson
CPython 3.12.3
Unexpected character found when decoding array value (2)
what this message means →
V8 JSON.parse
Node.js 22.22.2
Expected ',' or ']' after array element in JSON at position 5 (line 1 column 6)
what this message means →

What the specification says

The exact sections that govern this error. Descriptions are our paraphrase; follow the links for the normative text.

Body Section
IETF
An array is square brackets around zero or more values, with elements separated by commas.
Ecma International
Gives the array grammar; values are separated by commas.

Other errors in this category

Unclosed object — unexpected end of JSON input

The document ends before its closing brace. Caused by truncated downloads, a response cut off by a timeout, a log line that hit a …

Unterminated string in JSON

A string opens but never closes, so the parser consumes the rest of the document looking for the closing quote. A double quote ins…

← All JSON parser errors