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 unquoted keys that contain a hyphen or a space.
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 Words Are Not an Error
Reserved JavaScript words are valid unquoted keys in JSON6. If a parser rejects one, it is not a JSON6 parser.
// Valid - reserved words are allowed unquoted { class: 'container' } // Also valid - quoting is a style choice { '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.