JSON5

JSON for humans: an extended JSON syntax with comments, trailing commas, and unquoted keys for hand-written config.

Library
npm
v2.2.3
7,156stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity0
Maintenance20
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture82
Code Quality85
Innovation88
Learning Curve90

JSON5 is an extension of the JSON format designed to be easier to write and maintain by hand, especially for configuration files. It adds ECMAScript 5.1 conveniences that plain JSON forbids: comments, trailing commas, single-quoted and unquoted object keys, hexadecimal numbers, and multi-line strings, while remaining a strict superset so every valid JSON file is also valid JSON5.

This JavaScript library is the reference implementation of the JSON5 Data Interchange Format, exposing a parse/stringify API that mirrors the native JSON object. It ships with zero runtime dependencies, TypeScript definitions, and a small CLI for converting JSON5 to JSON, and is depended upon by major projects including Chromium, Next.js, and Babel.

What You Get

  • A JSON5.parse() function that accepts the full JSON5 grammar plus an optional reviver, matching the native JSON.parse signature.
  • A JSON5.stringify() function with replacer, spacing, and custom quote-character options for producing readable output.
  • Bundled TypeScript type definitions and both CommonJS and ES module entry points for Node.js and browsers.
  • A json5 command-line tool for converting JSON5 files to JSON and validating JSON5 syntax.
  • A json5/lib/register hook that lets Node.js require() load .json5 files directly.

Common Use Cases

  • Writing application and tooling configuration files that need inline comments and forgiving syntax.
  • Loading hand-edited config into a build pipeline or CLI where trailing commas and unquoted keys reduce friction.
  • Migrating existing JSON config to a more maintainable format without breaking compatibility.
  • Validating or converting JSON5 documents to plain JSON as part of a CI or packaging step.

Under The Hood

Architecture The library is organized as small single-purpose CommonJS modules under lib/, aggregated by lib/index.js into a JSON5 object exposing parse and stringify. lib/parse.js implements a hand-written lexer plus recursive-descent parser driven by two explicit state machines: a lexState table that tokenizes characters into JSON5 tokens and a parseState table that assembles them into a value tree, tracking line, column, and pos so syntax errors report precise locations. lib/stringify.js walks a JavaScript value recursively to emit JSON5 text, honoring replacer functions/arrays, indentation, and a configurable quote character. Character classification (identifier-start, identifier-continue, space separators) is delegated to lib/util.js, which tests against large generated Unicode regexes in lib/unicode.js. lib/cli.js wraps the same API for command-line conversion and validation.

Tech Stack JSON5 is written in plain JavaScript targeting ES5 (engines.node >= 6) with zero runtime dependencies. The distributable bundles are produced by Rollup with the Buble transpiler and Terser minifier (rollup.config.js), generating UMD and ES module builds under dist/. TypeScript consumers are served by hand-authored .d.ts files alongside each module. The lib/unicode.js tables are code-generated via the regenerate and unicode-10.0.0 dev dependencies.

Code Quality The project holds itself to a strict quality bar: the test suite under test/ (parse.js, stringify.js, cli.js, errors.js, require.js) runs under tap with a --100 flag enforcing 100% coverage, and eslint with the standard config runs as part of npm test. Error handling is a strength — the parser throws SyntaxError instances enriched with line and column numbers and descriptive messages. Naming is consistent, modules are cohesive, and TypeScript definitions are maintained in lockstep with the implementation.

API Design The public surface is intentionally tiny and instantly familiar: parse and stringify mirror the native JSON API down to the reviver, replacer, and space parameters, so any JavaScript developer can adopt JSON5 with essentially zero learning curve. The optional object form of stringify (with quote, replacer, and space keys) adds flexibility without complicating the common path, and the README documents every parameter with examples. Node’s require hook and the CLI extend the same mental model to files and the terminal.

Used by 27 apps in this directory

TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,872

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
95
Repo Health
82
Technical
66
Dependency
Built with
TypeScript100%
Updated yesterday
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
TypeScript
97%
Apache 2.0

Cline

AI Code Assistants

66,453

An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.

View details
90
Repo Health
74
Technical
67
Dependency
Built with
TypeScript97%
Updated today
C++
51%
Other

Cocos Engine

Developer Tools · Game Development · Design Tools

9,761

Open-source, cross-platform 2D/3D game engine with Vulkan, Metal, and WebGL support for web, mobile, and instant gaming platforms

View details
68
Repo Health
79
Technical
71
Dependency
Built with
C++51%
TypeScript35%
Updated 1 months ago
TypeScript
45%
Other

Convex Backend

Developer Tools · Databases

12,394

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

View details
88
Repo Health
82
Technical
70
Dependency
Built with
TypeScript45%
Rust43%
Updated today
TypeScript
97%
MIT

DenchClaw

CRM · AI Agents

1,643

An AI-native CRM you self-host on your own machine, built on the OpenClaw agent framework, with a DuckDB backend and pre-built agent skills for managing contacts, deals, reports, and 500+ outreach integrations from natural-language chat.

View details
69
Repo Health
73
Technical
71
Dependency
Built with
TypeScript97%
Updated 2 months ago
TypeScript
89%
Other

FastGPT

AI Agents · AI Development

29,387

Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.

View details
93
Repo Health
84
Technical
70
Dependency
Built with
TypeScript89%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search