JSON.parse SyntaxError: Unexpected token `}` / `]` (Trailing Comma or Comment)
Strict RFC 8259 JSON forbids trailing commas, single quotes, and `//` comments.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: JSON.parse SyntaxError
Platform: Data
Common Root Causes:
- Strict RFC 8259 JSON forbids trailing commas, single quotes, and `//` comments.
Interactive Diagnostic Checklist
Verified Solutions:
- Remove trailing commas/comments or use JSONC/JSON5 explicitly for human config files.
Safe Diagnostic Command:
jq . <file.json>
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Strict RFC 8259 JSON forbids trailing commas, single quotes, and `//` comments. Recommended diagnostic: `jq . <file.json>`. Remediation: Remove trailing commas/comments or use JSONC/JSON5 explicitly for human config files.
Worked Examples
- Run `jq . <file.json>` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-data-json-trailing-comma-parse · Independently verified: 2026-11-25