Gathering detailed insights and metrics for @casual-simulation/fast-json-stable-stringify
Gathering detailed insights and metrics for @casual-simulation/fast-json-stable-stringify
Gathering detailed insights and metrics for @casual-simulation/fast-json-stable-stringify
Gathering detailed insights and metrics for @casual-simulation/fast-json-stable-stringify
Casual Open Simulation for the Web
npm install @casual-simulation/fast-json-stable-stringify
Typescript
Module System
Min. Node Version
Node Version
NPM Version
72.2
Supply Chain
99.3
Quality
90.5
Maintenance
100
Vulnerability
100
License
TypeScript (63.5%)
JavaScript (27.57%)
TeX (7.33%)
Vue (1.17%)
CSS (0.26%)
HTML (0.1%)
Shell (0.04%)
SCSS (0.02%)
Dockerfile (0.01%)
Total Downloads
20,459
Last Day
1
Last Week
148
Last Month
905
Last Year
7,091
NOASSERTION License
50 Stars
13,699 Commits
10 Forks
7 Watchers
259 Branches
13 Contributors
Updated on Apr 25, 2025
Minified
Minified + Gzipped
Latest Version
3.4.0
Package Id
@casual-simulation/fast-json-stable-stringify@3.4.0
Unpacked Size
161.53 kB
Size
44.38 kB
File Count
9
NPM Version
lerna/8.0.0/node@v18.20.7+x64 (linux)
Node Version
18.20.7
Published on
Apr 05, 2025
Cumulative downloads
Total Downloads
No dependencies detected.
Forked from https://github.com/epoberezkin/fast-json-stable-stringify. Changes include converting to TypeScript and adding the ability to indent JSON output.
Deterministic JSON.stringify()
- a faster version of @substack's json-stable-strigify without jsonify.
You can also pass in a custom comparison function.
1var stringify = require('fast-json-stable-stringify'); 2var obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 }; 3console.log(stringify(obj));
output:
{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}
1var stringify = require('fast-json-stable-stringify');
Return a deterministic stringified string str
from the object obj
.
If opts
is given, you can supply an opts.cmp
to have a custom comparison
function for object keys. Your function opts.cmp
is called with these
parameters:
1opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue });
For example, to sort on the object key names in reverse order you could write:
1var stringify = require('fast-json-stable-stringify'); 2 3var obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 }; 4var s = stringify(obj, function (a, b) { 5 return a.key < b.key ? 1 : -1; 6}); 7console.log(s);
which results in the output string:
{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}
Or if you wanted to sort on the object values in reverse order, you could write:
var stringify = require('fast-json-stable-stringify');
var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 };
var s = stringify(obj, function (a, b) {
return a.value < b.value ? 1 : -1;
});
console.log(s);
which outputs:
{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10}
Pass true
in opts.cycles
to stringify circular property as __cycle__
- the result will not be a valid JSON string in this case.
TypeError will be thrown in case of circular object without this option.
With npm do:
npm install fast-json-stable-stringify
To run benchmark (requires Node.js 6+):
node benchmark
Results:
fast-json-stable-stringify x 17,189 ops/sec ±1.43% (83 runs sampled)
json-stable-stringify x 13,634 ops/sec ±1.39% (85 runs sampled)
fast-stable-stringify x 20,212 ops/sec ±1.20% (84 runs sampled)
faster-stable-stringify x 15,549 ops/sec ±1.12% (84 runs sampled)
The fastest is fast-stable-stringify
fast-json-stable-stringify package is a part of Tidelift enterprise subscription - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers.
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues.
No vulnerabilities found.
Reason
30 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
packaging workflow detected
Details
Reason
project is fuzzed
Details
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 1/23 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
39 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-04-21
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
0%
1
Compared to previous day
Last Week
-2.6%
148
Compared to previous week
Last Month
193.8%
905
Compared to previous month
Last Year
4.2%
7,091
Compared to previous year