# deterministic-json

> Deterministic JSON parse/stringify that supports Buffers

Latest version **1.0.5** (published 2018-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install deterministic-json
pnpm add deterministic-json
yarn add deterministic-json
bun add deterministic-json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2018-07-28 |
| First published | 2018-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 132.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matt Bell |
| Maintainers | mappum |
| Keywords | json, deterministic, crypto |

## Links

- npm: https://www.npmjs.com/package/deterministic-json
- npm.io page: https://npm.io/package/deterministic-json

## Dependencies (1)

- [json-stable-stringify](https://npm.io/package/json-stable-stringify.md) ^1.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.5 (latest) — 2018-07-28
- 1.0.4 — 2018-05-02
- 1.0.3 — 2018-04-25
- 1.0.2 — 2018-04-25
- 1.0.1 — 2018-04-25
- 1.0.0 — 2018-04-25

## README

# 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`

```js
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> }
```

---
_Source: https://npm.io/package/deterministic-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
