Unclosed Bracket or Brace in JSON
Every opening brace { must have a matching closing brace }, and every opening bracket [ must have a matching closing bracket ]. An unclosed bracket usually means you forgot to close a nested object or array, or you accidentally deleted a closing character.
Why It Matters
The parser reaches the end of the document expecting more content. The error message usually says 'unexpected end of input' which can be confusing because the actual problem is a missing bracket somewhere earlier in the document.
Common Causes
- Forgetting to close a nested object or array deep inside the document.
- Closing an array with a brace } or an object with a bracket ], so the counts never balance.
- Accidentally deleting a closing } or ] while editing, often during a copy-paste or merge.
Code Examples
{
"users": [
{
"name": "Alice",
"age": 25
},
{
"name": "Bob",
"age": 30
]
}{
"users": [
{
"name": "Alice",
"age": 25
},
{
"name": "Bob",
"age": 30
}
]
}How to Fix
- 1Use an editor with bracket matching to find unmatched brackets and braces.
- 2Indent your JSON properly. Mismatched brackets become obvious with correct indentation.
- 3Count opening and closing brackets. The numbers must match for both {} and [].
- 4Start from the error position and work backwards to find the unclosed structure.
Frequently Asked Questions
Why does the error say unexpected end of input?
How do I find which bracket is unclosed?
Can a closing brace fix an array, or do I need a bracket?
Check Your JSON Now
Our JSON validator detects this error automatically and shows the exact line and column.
Open JSON ValidatorCloudways · Managed Cloud Hosting
Fix this JSON error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).
Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303
Related JSON Errors
Unexpected Token in JSON
Fix the unexpected token error in JSON fast. See why parsers fail on trailing commas, single quotes, unquoted keys, and comments, with clear examples.
Missing Comma Between Properties
Fix the missing comma error in JSON the right way. Every key-value pair and array element must be separated by a comma, and our examples show where.
Invalid Nesting in JSON
Learn how to fix improperly nested objects and arrays in JSON documents. We show why a single structural slip cascades and how to correct it cleanly.