JSON, JSONC, and JSON5 look similar, but they are not interchangeable. Mixing them is a common cause of parser errors.
{
// JSONC / JSON5 allow comments in some tools
name: 'ToolGarden',
tags: ['json', 'tools'],
}Core Differences
| Format | Standard JSON? | Main trait |
|---|---|---|
| JSON | Yes | Strict and widely supported for APIs and data exchange |
| JSONC | No | Common for config files, allows comments, stays close to JSON |
| JSON5 | No | More JavaScript-like, allows single quotes, trailing commas, unquoted keys, and more |
Which One Should You Use?
- For API requests and responses, use standard JSON.
- For human-maintained config files, JSONC can work when the toolchain supports it.
- For JavaScript-like authoring convenience, JSON5 can be useful but is not accepted by ordinary JSON APIs.
- Before sending data to a backend, database, or third-party system, convert to standard JSON.