Java JSON canonicalization JSON canonicalize implementation. Creates crypto safe predictable canocalization of JSON as defined by RFC8785
{
"from_account": "543 232 625-3",
"to_account": "321 567 636-4",
"amount": 500,
"currency": "USD"
}
{
"1": {"f": {"f": "hi","F": 5} ,"\n": 56.0},
"10": { },
"": "empty",
"a": { },
"111": [ {"e": "yes","E": "no" } ],
"A": { }
}
String json = new String(Files.readAllBytes(Paths.get("filename.json")));
JsonCanonicalizer jc = new JsonCanonicalizer(json);
System.out.println(jc.getEncodedString());
// output normal: {"amount":500,"currency":"USD","from_account":"543 232 625-3","to_account":"321 567 636-4"}
// output crazy: {"":"empty","1":{"\n":56,"f":{"F":5,"f":"hi"}},"10":{},"111":[{"E":"no","e":"yes"}],"A":{},"a":{}}
<dependency>
<groupId>io.github.erdtman</groupId>
<artifactId>java-json-canonicalization</artifactId>
<version>1.1</version>
</dependency>
compile 'io.github.erdtman:java-json-canonicalization:1.1'
compile(group = "io.github.erdtman", name = "java-json-canonicalization", version = "1.1")
libraryDependencies += "io.github.erdtman" % "java-json-canonicalization" % "1.1"
<dependency org="io.github.erdtman" name="java-json-canonicalization" rev="1.1" />
@Grapes(
@Grab(group='io.github.erdtman', module='java-json-canonicalization', version='1.1')
)
[io.github.erdtman/java-json-canonicalization "1.1"]
'io.github.erdtman:java-json-canonicalization:jar:1.1'
pkg:maven/io.github.erdtman/[email protected]