JSON5 vs JSON6, Tested Side by Side

Two extensions of JSON, the same inputs, and every difference we could measure.

JSON6 is a real, separate format: a proposal by one author, published in 2017, that keeps everything JSON5 allows and adds ES6-era conveniences such as 0o numbers, digit separators and undefined. It is not the next version of JSON5, and it has no written specification.

We ran the json5 2.2.3 and json-6 1.1.7 npm packages on the same documents, then the official test suite and a speed test, and read both repositories. The results include one security-relevant difference.

Two parsers on a workbench reading the same document, one stamped JSON5 and one stamped JSON6, with a short list of differing lines between them

TL;DR: json-6 read all 81 valid documents in the official JSON5 test suite with identical values, accepts 16 of the 31 documents that suite marks invalid, and parsed about five times faster than json5 in our test. It has no specification, almost no usage, and release 1.1.7 on npm has a prototype bug that json5 fixed in 2022. Choose JSON5 unless only your own JavaScript reads the files and you want JSON6's extras.

Compare icon

What Each Format Is

JSON6 lives in the d3x0r/JSON6 repository, created in July 2017, and in the npm package json-6. Its README calls it "a proposed extension to JSON", says it "adds no new data types", and states that it "is not an official successor to JSON". It also says its documentation base was cloned from the JSON5 project, which it credits as the inspiration. The README ends its description of the file name with a note that a media type is still to be done: "TODO: new MIME type needed too."

JSON5, by contrast, has a numbered 1.0.0 specification from March 2018 whose abstract also uses the word "proposed". Neither is an Ecma, IETF or ISO standard; see standards status. The table compares the projects as of November 29, 2026.

QuestionJSON5JSON6
Repository createdMay 27, 2012July 13, 2017
Written specificationVersion 1.0.0, March 2018None; the README and the reference parser define it
Reference JavaScript packagejson5 2.2.3 (December 31, 2022)json-6 1.1.7 (October 16, 2026)
LicenseMITMIT
npm downloads, November 22-28, 2026303,643,2991,468
Browser build, minified (gzipped)31,631 bytes (9,508)32,046 bytes (11,637)
Runtime dependenciesNoneNone
File extension.json5 by convention.json6
Registered media typeNoneNone; listed as a TODO

Download counts include indirect installs and say nothing about how many people write either format. Sizes were measured from the dist/index.min.js file in each package.

Table icon

Feature Matrix

Every row was checked by parsing a sample with both packages; none comes from a README alone. JSON6 is a superset of JSON5 in this table, with the two exceptions noted at the bottom.

FeatureJSON5JSON6
Comments, // and /* */YesYes
Trailing commasYesYes
Unquoted keys that are ES5 identifiersYesYes
Unquoted keys with punctuation, such as content-type or @xNoYes
Unquoted numeric keys, such as {123: 1}NoYes key keeps its source text
Single-quoted stringsYesYes
Back-tick stringsNoYes no substitution
Raw line breaks inside a stringNoYes newline is kept
Backslash line continuationYesYes
\xNN escapesYesYes
\u{1F600} escapesNoYes
Hexadecimal numbers, 0xFFYesYes
Binary and octal numbers, 0b101 and 0o17NoYes
Leading zeros in decimals, 010NoYes reads as 10, not octal
Digit separators, 1_000NoYes
Leading decimal point and trailing decimal pointYesYes
Leading plus signYesYes
Stacked signs, --5NoYes
Infinity and NaNYesYes
The undefined keywordNoYes
Empty array elements, [1,,3]NoYes
Unicode escape inside an unquoted key, {\u0061: 1}Yes key is aNo key keeps the backslash text
Rejects text after the first valueYesNo ignores it
Streaming readerNoYes begin() and write()
Errors carry lineNumber and columnNumberYes on a SyntaxErrorNo position appears only in the message

The unicode-escape and trailing-text rows are the two exceptions to the superset claim; the last two rows describe the API, not the grammar. JSON6 also has opt-in options, all off by default: esStrictCompatible, forbidTemplateSubstitution, normalizeNumericKeys and warnWithCommentWithoutEOL. For the full JSON5 grammar see the syntax page.

Code icon

Tested Examples

First, an ordinary JSON5 document. Both packages return the same object, and util.isDeepStrictEqual confirmed it:

{ // listen port port: 0x1F90, host: 'localhost', tags: ['a', 'b',], } // both: { port: 8080, host: 'localhost', tags: [ 'a', 'b' ] }

Next, a document that uses JSON6 additions. The reference JSON5 parser stops at the first one. JSON6 reads all of it:

{ mode: 0o644, retries: 1_000, content-type: `text/plain`, note: 'two lines', skip: undefined, list: [1,,3], } // json5 2.2.3: SyntaxError: JSON5: invalid character 'o' at 2:10 // json-6 1.1.7: { mode: 420, retries: 1000, 'content-type': 'text/plain', // note: 'two\nlines', skip: undefined, list: [ 1, <1 empty item>, 3 ] }

Taking the additions one at a time shows what json5 says about each:

Inputjson5 2.2.3json-6 1.1.7
{mode: 0o644}invalid character 'o' at 1:9{ mode: 420 }
{n: 1_000}invalid character '_' at 1:6{ n: 1000 }
{n: 0b101}invalid character 'b' at 1:6{ n: 5 }
{content-type: 1}invalid character '-' at 1:9{ 'content-type': 1 }
{u: undefined}invalid character 'u' at 1:5{ u: undefined }
[1,,3]invalid character ',' at 1:4array of length 3 with a hole

Converting. JSON6 text becomes JSON through JSON.stringify(JSON6.parse(text)), which turns undefined properties into nothing and holes into null: the second example gives {"mode":420,"retries":1000,"content-type":"text/plain","note":"two\nlines","list":[1,null,3]}. The package also installs a command that does the same to a file. Its README names it json6, but npm links it as json-6: json-6 -c config.json6 writes config.json next to it.

Warning icon

Same Input, Different Result

The additions above reject or accept by design. These cases matter more, because the two parsers give different meanings or different verdicts to text that looks ordinary:

Inputjson5 2.2.3json-6 1.1.7
010SyntaxError10 (decimal; a JavaScript source file would read 8)
"\012"SyntaxError at 1:4a NUL character followed by 12
{a:1}xSyntaxError{ a: 1 }, the trailing x is ignored
{a:1} {b:2}SyntaxError{ a: 1 }
[1,,]SyntaxErrorarray of length 2 with a hole
{1e3:1}SyntaxErrorkey '1e3'; with the normalizeNumericKeys option the key is '1000'
{\u0061:1}{ a: 1 }one key whose text is the six characters \u0061
{"__proto__":{"x":1}}own key named __proto__sets the prototype of the result (see Security)

The leading-zero rule is documented and argued at length in the JSON6 README, which also lists the alternatives it rejected. We found no description of the trailing-text rule in the README; it appears to follow from the parser's streaming design, in which the parser returns the first complete value. The practical effect is that a truncated or corrupted file with a valid prefix is accepted, so validate with a parser that rejects trailing text if that matters.

One more behavior to know: after a parse that fails inside an array or object, the next call can return the half-built value instead of throwing. In 1.1.7, parse('[1 2]') throws, and a following parse('// c') returns [] instead of "No value found in document". A fresh process behaves correctly. The version on the repository's main branch shows the same leftover state. Keep that in mind when one process parses many documents.

Test icon

The Official Test Suite

The json5-tests repository holds valid documents (.json and .json5) and invalid ones (.js and .txt) in category folders. We parsed each file in its own process and left the experimental todo folder out of the totals. See conformance for how the suite is organized.

Checkjson5 2.2.3json-6 1.1.7
Valid documents accepted, of 818181
Accepted documents whose value matches the reference8181
Invalid documents rejected, of 313115

The 16 invalid documents that json-6 accepts fall into five groups: ten number forms such as 010, +0123 and -098; two arrays that start with or consist of a comma; two unquoted keys containing a digit prefix or a hyphen; a string with a raw line break; and a document where a value is followed by an unterminated block comment. Each is a deliberate JSON6 extension or the trailing-text rule above, not a defect of the suite. The JSON5 specification's conformance section says that a parser "may accept non-JSON5 forms or extensions", so accepting them does not make json-6 non-conforming; it makes it a superset that cannot be used to check JSON5 files.

In the experimental todo folder, one case differs: unicode-escaped-unquoted-key.json5, the {\u0061: 1} row above. The JSON5 specification allows a Unicode escape in an identifier, so a strict superset would read it the same way.

Edit icon

Writing: stringify Compared

Both packages offer stringify. Their output differs in ways that matter if another program reads it:

Behaviorjson5 2.2.3json-6 1.1.7
Key orderAs insertedSorted alphabetically unless sortKeys is set to false
String quotesSingle quotes, or double if the text holds a single quoteAlways double quotes
undefined array elementnullWritten as undefined
Array holenullPreserved: [1,,3]
Date valueISO string, through toJSON{}; toJSON is not called
BigIntProperty silently droppedProperty silently dropped
Newline inside a stringEscapedWritten as a raw line break
Apostrophe in a string"it's""it\'s", which is not valid JSON

The result is asymmetric. json-6 reads JSON5 output without trouble, including NaN and -Infinity. json5 cannot read json-6 output that contains undefined or holes: it fails with invalid character 'u' at 1:7 on {b:[1,undefined,3]}. Treat JSON6 text as JSON6, and convert to JSON, not JSON5, if another tool must read it.

Speed icon

Speed

The JSON6 README says its parser is "nearly double the speed" of the JSON5 implementation. Speed is one reason the format exists, so we measured it. The input was JSON5 text for generated records of 12, 600 and 6,000 items, written by json5 itself; JSON.parse read the equivalent JSON as a baseline. Node.js 24.22.1, Intel Core i9-9900, Windows 11, median of 31 to 1,001 runs after warm-up, November 29, 2026.

InputJSON.parsejson5 2.2.3json-6 1.1.7json-6 vs json5
3.4 KB0.01 ms0.34 ms0.07 msabout 5x faster
170 KB0.47 ms18 ms3.7 to 4.0 msabout 4.5x to 5x faster
1.7 MB5.0 ms196 to 255 ms39 to 42 msabout 5x to 6x faster

On this data json-6 was about five times faster than json5, more than the README claims, and still roughly four to eight times slower than native JSON.parse (a second run on smaller records gave about four times). The README does not say what it measured. As with any parser, the difference is invisible for a config file read once and visible when you parse megabytes. The reference library's unreleased changelog lists parser speedups of its own, so the gap may narrow; see criticism and limits for all the speed figures.

npm logo

Libraries and Tooling

json-6 exports a JSON6 object with parse, stringify, escape, begin and stringifier, in CommonJS and as an ES module, with TypeScript declarations and a .json6 loader for Node.js. Its README says the format is also implemented in the sack.vfs native Node.js add-on, and it names no implementation in another language.

JSON5 has libraries for most languages; the implementations page lists them with versions, and several platforms parse it natively. We did not test editors, linters or formatters with .json6 files, so check them before you rely on them.

Time icon

Maintenance

Both projects have long quiet periods followed by bursts. The reference JSON5 library's last release is from December 2022, and its main branch took 37 commits between October 15 and 29, 2026. json-6 published 1.1.3 on October 13, 2021 and 1.1.4 five days later, then nothing until 1.1.5 and 1.1.6 on October 11, 2026 and 1.1.7 on October 16, 2026. Its repository took a further commit on November 12, 2026, discussed below. One outside contributor sent five pull requests between September and October 2026.

Two open discussions from 2019 show the relationship between the projects: "Keep in sync with JSON5 improvements?" and "Collaborations with JSON5's standardization". The second has no replies. The JSON6 license file asks users to share notable improvements, and says the author tried to get the JSON5 maintainers to implement the changes first but found them unresponsive. We report that as the author's statement. We did not contact either project.

The practical reading: JSON6 is one person's proposal with recent activity and a tiny user base. JSON5 has a large user base, a frozen specification and a slow release schedule.

Security icon

Security Notes

In 2022 the reference JSON5 library had CVE-2022-46175: a key named __proto__ in the input set the prototype of the returned object instead of becoming an ordinary property. It was fixed in 2.2.2 and 1.0.2. We ran the same input through json-6 1.1.7 and through json5 2.2.1, the last vulnerable 2.x release:

const text = '{"theme":"dark","__proto__":{"isAdmin":true}}'; const o = parser.parse(text); Object.keys(o); // [ 'theme' ] in both o.isAdmin; // true in both Object.hasOwn(o, 'isAdmin'); // false in both Object.getPrototypeOf(o) === Object.prototype; // false in both ({}).isAdmin; // undefined: the global prototype is untouched

The behavior matches json5 before the fix, and so does the exposure: a check that lists the keys of the parsed object does not see isAdmin, yet a later read of o.isAdmin finds true. A reviver cannot filter it either: in our test the parser never presented the __proto__ key to the reviver. The advisory for the JSON5 bug describes the same consequences; read the security tutorial for the patterns that make it exploitable.

Status. The json-6 repository fixed this on November 12, 2026 in commit ee1ebe2, titled "A literal __proto__ key is data, not a prototype". Its message says that JSON.parse makes a plain own property of the name and that the parser now does the same. The npm package is still 1.1.7, published October 16, 2026, and the repository's tags stop at 1.1.7, so the fix is in the source and not in a published release as of November 29, 2026. The GitHub Advisory Database has no entry for json-6. We tested the repository's main branch: for a document with a __proto__ key it returns [ '__proto__' ] as the keys of the result.

What to do. Do not use json-6 1.1.7 on text from outside your control. If you must, check the result of each parse, for objects at any depth:

function hasForeignPrototype(o) { return Object.getPrototypeOf(o) !== Object.prototype; } hasForeignPrototype(JSON6.parse('{a:1}')); // false hasForeignPrototype(JSON6.parse('{__proto__:{x:1}}')); // true

Safer still, parse untrusted input with json5 2.2.3 or JSON.parse. The trailing-text and leftover-state behaviors above are separate reasons to be careful. Neither is a vulnerability by itself, but both can make validation weaker than it looks.

Target icon

Choosing Between Them

Your situationPickWhy
Files read by tools in several languages, or by tools you do not controlJSON5A specification, many ports, native support on several platforms
Files read by a program other than your own, or accepted from usersJSON5Strict rejection of trailing text and extensions; the prototype fix is released
Config files read only by your own JavaScript or TypeScript, where you want 0o numbers, separators or back-tick stringsJSON6, or JSON5 plus decimals and quotesThe extras are real, and the cost is a format few tools know
Large JSON5-like text parsed in a loopNeitherBoth are well behind JSON.parse; use JSON
You need to edit files without losing commentsNeither librarySee the editing parsers on the criticism page

If you adopt JSON6, name files .json6 so nobody feeds them to a JSON5 parser, pin the version, and keep an eye on the repository for a release that includes the November 2026 fix. Our default advice is simpler: write JSON5 and parse it once. The family page shows where JSON6 sits among the other relatives.

Common Questions

Is JSON6 the next version of JSON5?

No. It is an independent proposal that builds on JSON5 and says it is not an official successor to JSON. The JSON5 project did not issue it. See why the name confuses people.

Can a JSON5 parser read JSON6?

Only the part that is also JSON5. Any document using 0o, _, back-ticks, undefined, holes or punctuation in keys fails with a syntax error.

Can a JSON6 parser read JSON5?

Yes for all 81 valid documents in the official suite, plus the caveats in this page: it also accepts invalid ones, and it reads a Unicode escape in an unquoted key differently.

Is JSON6 faster?

In our test, about five times faster than json5 2.2.3 and four to eight times slower than JSON.parse, depending on the data. For small files neither matters.

Is JSON6 safe to use?

On trusted files, yes. On untrusted input, avoid release 1.1.7 until a version with the prototype fix is published; the Security section has the details.

Where can I learn more about JSON6?

Start with its own repository and README, linked under Related Pages and in the references. Our sister site covers it in more depth.