canonicalize
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.8 • Public • Published

    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
    

    Install

    npm i canonicalize

    DownloadsWeekly Downloads

    167,969

    Version

    1.0.8

    License

    Apache-2.0

    Unpacked Size

    20.7 kB

    Total Files

    19

    Last publish

    Collaborators

    • samuelerdtman