canonicalize
JSON canonicalize function
Last updated 6 years ago by samuelerdtman .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install canonicalize 
SYNC missed versions from official npm registry.

Build Status Coverage Status

canonicalize

JSON canonicalize function. Creates crypto safe predictable canocalization of JSON as defined by RFC8785

Usage

Normal Example

const canonicalize = require('canonicalize');
const  json = {
	"from_account": "543 232 625-3",
	"to_account": "321 567 636-4",
	"amount": 500,
	"currency": "USD"
}
console.log(canonicalize(json));
// output: {"amount":500,"currency":"USD","from_account":"543 232 625-3","to_account":"321 567 636-4"}

Crazy Example

const canonicalize = require('canonicalize');
const  json = {
	"1": {"f": {"f":  "hi","F":  5} ,"\n":  56.0},
	"10": { },
	"":  "empty",
	"a": { },
	"111": [ {"e":  "yes","E":  "no" } ],
	"A": { }
}
console.log(canonicalize(json));
// output: {"":"empty","1":{"\n":56,"f":{"F":5,"f":"hi"}},"10":{},"111":[{"E":"no","e":"yes"}],"A":{},"a":{}}

Install

npm install canonicalize --save

Test

npm test

Current Tags

  • 5.1.0                                ...           latest (2 months ago)

15 Versions

  • 5.1.0                                ...           2 months ago
  • 5.0.0                                ...           3 months ago
  • 4.0.0                                ...           4 months ago
  • 3.0.0                                ...           8 months ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.8                                ...           5 years ago
  • 1.0.7                                ...           5 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           6 years ago
  • 1.0.4                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 24
Today 0
This Week 13
This Month 19
Last Day 0
Last Week 4
Last Month 5
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE