- Notifications
You must be signed in to change notification settings - Fork1
ahdinosaur/json-canon
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Serialize JSON into a canonical format.
Safe for generating a consistent cryptographic hash or signature across platforms.
FollowsRFC8785: JSON Canonicalization Scheme (JCS)
The JSON Canonicalization Scheme concept in a nutshell:
- Serialization of primitive JSON data types using methods compatible with ECMAScript's
JSON.stringify()
- Lexicographic sorting of JSON
Object
properties in arecursive process - JSON
Array
data is also subject to canonicalization,but element order remains untouched
constserialize=require('json-canon')constjson={from_account:"543 232 625-3",to_account:"321 567 636-4",amount:500,currency:"USD"}console.log(serialize(json))// {"amount":500,"currency":"USD","from_account":"543 232 625-3","to_account":"321 567 636-4"}
Rust:json-canon
use json_canon::to_string;use serde_json::json;let data =json!({"from_account":"543 232 625-3","to_account":"321 567 636-4","amount":500,"currency":"USD"});println!("{}", to_string(&data)?);// {"amount":500,"currency":"USD","from_account":"543 232 625-3","to_account":"321 567 636-4"}
- #"/ahdinosaur/json-canon/blob/main/js/json-canon-fuzz">
json-canon-fuzz
About
Serialize JSON into a canonical format.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.