canonicaljson

package
v0.19.0-mod-2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

README

canonicaljson

This is a Go package to produce Matrix Canonical JSON. It is essentially just json.go from gomatrixserverlib without all the other files that are completely useless for non-server use cases.

The original project is licensed under the Apache 2.0 license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalJSON

func CanonicalJSON(input []byte) ([]byte, error)

CanonicalJSON re-encodes the JSON in a canonical encoding. The encoding is the shortest possible encoding using integer values with sorted object keys. https://matrix.org/docs/spec/appendices#canonical-json

func CanonicalJSONAssumeValid

func CanonicalJSONAssumeValid(input []byte) []byte

CanonicalJSONAssumeValid is the same as CanonicalJSON, but assumes the input is valid JSON

func CompactJSON

func CompactJSON(input, output []byte) []byte

CompactJSON makes the encoded JSON as small as possible by removing whitespace and unneeded unicode escapes

func SortJSON

func SortJSON(input, output []byte) []byte

SortJSON reencodes the JSON with the object keys sorted by lexicographically by codepoint. The input must be valid JSON.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL