The jsoncanonicalizer folder contains the source code for a JCS (RFC 8785) compliant canonicalizer written in C# for .NET Core 3 and forward.
using Org.Webpki.JsonCanonicalizer;
JsonCanonicalizer jsonCanonicalizer = new JsonCanonicalizer(jsonString);
string result = jsonCanonicalizer.GetEncodedString();The JsonCanonicalizer() may also be invoked with a byte[] array holding JSON data in UTF-8 format.
In addition to GetEncodedString() there is a method GetEncodedUTF8() returning canonicalized data as
a byte[] array.
The JSON canonicalizer only accepts a JSON Object or Array as the top level data type.