Troubleshooting
Common problems and solutions when working with JSON6.
Quick Fix: Most JSON6 errors are parse errors from invalid syntax. Check for unclosed strings, missing commas, or reserved words used as unquoted keys.
Common Issues
Browse by problem type to find solutions.
Parse Errors
Fix syntax errors and invalid JSON6
Most CommonTrailing Commas
Issues with commas after the last item
Encoding Issues
UTF-8, BOM, and character problems
TypeScript Errors
Type issues with JSON6 parsing
Common Mistakes
Frequent errors and how to avoid them
Error Reference
Complete list of error messages
Quick Fixes
Try these common solutions first.
"Unexpected token" Error
Usually caused by a missing comma, unclosed string, or invalid character.
// Wrong - missing comma { a: 1 b: 2 } // Correct { a: 1, b: 2 }"Invalid identifier" Error
Unquoted keys must be valid JavaScript identifiers. Quote keys with special characters.
// Wrong - contains hyphen { my-key: 'value' } // Correct - quoted { 'my-key': 'value' }"Reserved word" Error
Reserved JavaScript words can't be used as unquoted keys. Quote them instead.
// Wrong - 'class' is reserved { class: 'container' } // Correct - quoted { 'class': 'container' }Comments Not Working
Make sure you're using a JSON6 parser, not a regular JSON parser.
// Wrong - using JSON.parse() JSON.parse(text) // Comments will cause errors // Correct - using JSON6.parse() JSON6.parse(text) // Comments are supportedJSON6 Validation Checklist
Run through this checklist to find common problems.
Online Validation
Use online tools to quickly validate your JSON6.
Getting Help
If you're still stuck, here are ways to get help.
GitHub Issues
Report bugs or ask questions on the json6 GitHub repository.
Stack Overflow
Search or ask questions with the json6 tag on Stack Overflow.
Contact Us
Have a question about this documentation? Contact us.
Still Having Issues?
Check our detailed parse errors guide or explore the complete error reference.