🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

json-stringify-deterministic

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
j

json-stringify-deterministic

deterministic version of JSON.stringify() so you can get a consistent hash from stringified results.

1.0.12
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

76

Maintenance

100

License

Version published
Weekly downloads
152K
-6.68%
Maintainers
1
Weekly downloads
 
Created
Issues
0

What is json-stringify-deterministic?

The json-stringify-deterministic package is a Node.js library that provides a deterministic version of JSON.stringify. It ensures that the JSON string output is consistent across different runs by sorting the object keys, which is particularly useful for caching, hashing, or comparing JSON data.

What are json-stringify-deterministic's main functionalities?

Deterministic JSON Stringification

This feature allows you to stringify a JavaScript object into a JSON string with keys sorted in a deterministic order. This ensures that the same object will always produce the same JSON string, which is useful for consistent hashing or comparison.

const stringify = require('json-stringify-deterministic');

const obj = { b: 1, a: 2 };
const jsonString = stringify(obj);
console.log(jsonString); // Output: '{"a":2,"b":1}'

Other packages similar to json-stringify-deterministic

FAQs

Package last updated on 24 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts