Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 29, 2024 via pnpm

json-stable-stringify-without-jsonify 1.0.1

deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies
Package summary
Share
0
issues
1
license
1
MIT
Package created
15 Dec 2016
Version published
15 Dec 2016
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
json-stable-stringify-without-jsonify@1.0.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of json-stable-stringify-without-jsonify 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does json-stable-stringify-without-jsonify do?

The npm package json-stable-stringify-without-jsonify serves as a deterministic version of JSON.stringify(). It allows users to generate a consistent hash from stringified results. This particular variant does not depend on libraries without licenses, differentiating it from other versions such as the one found at substack/json-stable-stringify. It also supports the inclusion of a custom comparison function for object keys, introducing an added layer of customization.

How do you use json-stable-stringify-without-jsonify?

To use json-stable-stringify-without-jsonify, begin by installing the npm package with npm install json-stable-stringify. Once installed, require the package in your JavaScript file. For instance, var stringify = require('json-stable-stringify'); allows you to utilize its functionalities.

For a basic use case, consider an object { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };. Using the stringify method, console.log(stringify(obj));, the output will be a deterministic stringified string of the object: {"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}.

For more advanced usage, you can supply options to have a custom comparison function for object keys, or modify the output for pretty-printing by specifying opts.space.

Example with a custom comparison function:

var stringify = require('json-stable-stringify');
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
var s = stringify(obj, function (a, b) {
    return a.key < b.key ? 1 : -1;
});
console.log(s); 
// Output: {"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}

Example with pretty-printing:

var obj = { b: 1, a: { foo: 'bar', and: [1, 2, 3] } };
var s = stringify(obj, { space: '  ' });
console.log(s);
// Output:
// {
//   "a": {
//     "and": [
//       1,
//       2,
//       3
//     ],
//     "foo": "bar"
//   },
//   "b": 1
// }

Where are the json-stable-stringify-without-jsonify docs?

The documentation for json-stable-stringify-without-jsonify can be found within the readme file in the package's GitHub repository. Users can learn about the methods and options as well as installation instructions and usage examples straight from the readme. An additional resource is the npm documentation page. The MIT License under which the package is released can also be reviewed in the readme.

All Versions