Why JSON6 ?

JSON is great for machines. JSON6 is great for humans.

The Problem with JSON

JSON was designed for data interchange between machines. It's strict, minimal, and unambiguous - perfect for APIs and data storage. But when humans need to write and maintain JSON by hand, its strictness becomes a burden.

No Comments

Can't document why a setting exists or what values are valid. Config files become cryptic over time.

Trailing Comma Errors

Copy-paste or reorder items? Hope you remembered to fix the commas. One wrong comma breaks everything.

Verbose Syntax

Every key needs quotes. Simple identifiers like name become "name". Extra typing, extra noise.

No Multi-line Strings

Long text must be on one line or split into arrays. SQL queries, templates, and descriptions become unreadable.

JSON6: The Solution

JSON6 extends JSON with features from ES6+, making it developer-friendly while staying machine-readable.

100% backward compatible. Every valid JSON file is already valid JSON6. Adopt features gradually.

Feature Deep Dive

Comments

Document your configuration with single-line (//) and multi-line (/* */) comments. Explain why settings exist, what values are valid, or leave notes for future maintainers.

JSON (no comments)

{ "timeout": 30000, "retries": 3 }

JSON6 (with comments)

{ // Timeout in milliseconds timeout: 30000, /* Retry failed requests up to 3 times */ retries: 3, }

Trailing Commas

Add commas after the last item in arrays and objects. No more hunting for comma errors when you reorder or add items. Cleaner diffs in version control too.

JSON (error!)

{ "features": [ "auth", "api", "dashboard", // Error! ], // Error! }

JSON6 (valid)

{ features: [ 'auth', 'api', 'dashboard', // OK! ], // OK! }

Unquoted Keys

Skip the quotes on object keys that are valid JavaScript identifiers. Less typing, less visual noise, more readable configs.

JSON (quotes required)

{ "name": "my-app", "version": "1.0.0", "private": true }

JSON6 (cleaner)

{ name: 'my-app', version: '1.0.0', private: true, }

Single Quotes

Use single or double quotes for strings. Great when your string contains double quotes - no escaping needed.

JSON (escaping needed)

{ "message": "Say \"Hello World\"" }

JSON6 (no escaping)

{ message: 'Say "Hello World"', }

Extended Number Syntax

Use hexadecimal numbers, leading/trailing decimals, explicit positive signs, and special values like Infinity and NaN.

{ color: 0xFF5733, // Hex color opacity: .5, // Leading decimal offset: +10, // Explicit positive maxSize: Infinity, // Special value invalid: NaN, // Not a number }

Multi-line Strings

Strings can span multiple lines by escaping the newline with a backslash. Great for SQL queries, templates, or any long text.

{ query: 'SELECT * \ FROM users \ WHERE active = true', }

When to Use JSON6

JSON6 excels in human-facing scenarios. Keep using JSON for machine-to-machine data.

Use JSON6 For

  • Configuration files - app settings, build configs, environment settings
  • Data fixtures - test data, seed data, mock responses
  • Localization files - i18n strings with translator notes
  • Design tokens - colors, spacing, typography with documentation

Keep Using JSON For

  • API responses - machine-generated, machine-consumed
  • Database storage - structured data that won't be hand-edited
  • Data interchange - when strict parsing is required
  • Security-critical - when you need guaranteed parsing behavior

Ready to Try JSON6?

Start using JSON6 in your projects today. It's easy to adopt and works with popular tools.