Format, validate, and convert JSON5 to standard JSON. Supports comments, trailing commas, unquoted keys, hex numbers, and more.
JSON5 is an extension of JSON that aims to be easier to write and maintain by hand. It's not a replacement for JSON but rather a superset that allows for a more relaxed, human-friendly syntax while remaining fully compatible with JavaScript object literals.
// Single-line comment
/* Multi-line
comment */
{
name: "value",
$price: 99,
_private: true
}
{
"items": [
"one",
"two",
"three", // OK!
],
}
{
'single': 'quotes',
"mixed": 'allowed'
}
{
hex: 0xDEADBEEF,
infinity: Infinity,
negInfinity: -Infinity,
nan: NaN,
leadingDot: .5,
trailingDot: 5.
}
{
multiline: "Line 1\
Line 2\
Line 3"
}
| Feature | JSON | JSONC | JSON5 |
|---|---|---|---|
| Comments | ❌ | ✅ | ✅ |
| Trailing commas | ❌ | ✅ | ✅ |
| Unquoted keys | ❌ | ❌ | ✅ |
| Single quotes | ❌ | ❌ | ✅ |
| Hex numbers | ❌ | ❌ | ✅ |
| Infinity/NaN | ❌ | ❌ | ✅ |
| Multi-line strings | ❌ | ❌ | ✅ |
| Leading/trailing decimals | ❌ | ❌ | ✅ |