The Human-Friendly JSON Format
The human-friendly data format. JSON, but better.
100% backward compatible with JSON
What is JSON5?
JSON5 is an extension of JSON that aims to make it easier for humans to write and maintain by hand. It adds minimal syntax features directly from ECMAScript 5.1.
Think of it as JSON for configuration files - where readability and ease of editing matter more than strict data interchange.
Full backward compatibility: All valid JSON files are valid JSON5 files. You can start using JSON5 features gradually.
Key Features
Everything you love about JSON, plus developer-friendly enhancements from ES5.
Comments
Single and multi-line comments to document your configuration.
// and /* */Trailing Commas
Add trailing commas in arrays and objects without errors.
["a", "b",]Unquoted Keys
Object keys don't need quotes if they're valid identifiers.
{name: "value"}Multi-line Strings
Strings can span multiple lines with backslash escaping.
"line1\line2"
Single Quotes
Use single or double quotes for strings interchangeably.
'string'Special Numbers
Hex, Infinity, NaN, leading/trailing decimals, explicit +.
0xFF, .5, +1Quick Example
// Configuration file in JSON5 { name: 'my-app', version: 2.0, port: 0x1F90, // 8080 in hex features: [ 'comments', 'trailing commas', 'unquoted keys', // trailing comma OK! ], /* Multi-line comments are also supported */ enabled: true, threshold: .5, // leading decimal }This file is both valid JSON5 and valid ES5 JavaScript!
JSON vs JSON5
See what JSON5 adds to make your config files more readable.
| Feature | JSON | JSON5 |
|---|---|---|
| Comments | Not allowed | // and /* */ |
| Trailing commas | Syntax error | Allowed |
| Unquoted keys | Must quote all | If valid identifier |
| String quotes | Double only | Single or double |
| Hex numbers | Not supported | 0xDECAF |
| Infinity/NaN | Not supported | Supported |
| Multi-line strings | Not supported | With \ escape |
Perfect For
JSON5 shines wherever humans edit JSON by hand.
Config Files
App settings with comments
Package Manifests
Annotated dependencies
Data Files
Human-readable datasets
Test Fixtures
Documented test data
Ready to Learn More?
Explore our comprehensive guides, examples, and resources to master JSON5.