Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deterministic-json

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deterministic-json

Deterministic JSON parse/stringify that supports Buffers

  • 1.0.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3.9K
decreased by-19.65%
Maintainers
1
Weekly downloads
 
Created
Source

deterministic-json

Deterministic JSON parse/stringify, with support for Buffers

When writing crypto code that needs deterministic JSON strings, usually you're working with a lot of binary data (signatures, ciphertext, public keys, etc.). So for convenience, this module both makes the output deterministic, and lets Buffers survive the stringification/parsing by converting to base64 strings.

Usage

npm install deterministic-json

let json = require('deterministic-json')

let string = json.stringify({ b: 0, c: 1, a: 2, key: Buffer.from('foo') })
// -> '{"a":2,"b":0,"c":1,"key":":base64:Zm9v"}'

let obj = json.parse(string)
// -> { a: 2, b: 0, c: 1, key: <Buffer 66 6f 6f> }

Keywords

FAQs

Package last updated on 28 Jul 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc