canonicaljson

package
v0.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: MPL-2.0, Apache-2.0 Imports: 5 Imported by: 3

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.

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 RawJSONFromResult

func RawJSONFromResult(result gjson.Result, input []byte) (RawJSON []byte)

RawJSONFromResult extracts the raw JSON bytes pointed to by result. input must be the json bytes that were used to generate result

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