Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Serialize JSON into a canonical format.

NotificationsYou must be signed in to change notification settings

ahdinosaur/json-canon

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)

JSON cannon

Features

The JSON Canonicalization Scheme concept in a nutshell:

  • Serialization of primitive JSON data types using methods compatible with ECMAScript'sJSON.stringify()
  • Lexicographic sorting of JSONObject properties in arecursive process
  • JSONArray data is also subject to canonicalization,but element order remains untouched

Serializers

#"/ahdinosaur/json-canon/blob/main/js/json-canon">json-canon

npm versiondownloadci status

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"}

crates.io versiondownloaddocs.rs docsci status

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"}

Fuzzers

  • #"/ahdinosaur/json-canon/blob/main/js/json-canon-fuzz">json-canon-fuzz

References

About

Serialize JSON into a canonical format.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp