std/encoding/json/jcs
import "github.com/eugenioenko/goalchemy/std/encoding/json/jcs"Package jcs implements the JSON Canonicalization Scheme of RFC 8785. Transform parses JSON text and returns its canonical encoding: object members sorted by the UTF-16 code units of their names, no insignificant whitespace, strings with only the escapes RFC 8785 requires, and numbers written as ECMAScript’s Number::toString writes them. Invalid JSON, duplicate member names, and numbers that are not finite doubles are errors.
Encode
Section titled “Encode”func Encode(v jsonvalue.Value) ([]byte, error)Encode returns the RFC 8785 canonical encoding of v. Numbers are read from their source text; a number outside the finite double range is a NumberError.
Transform
Section titled “Transform”func Transform(data []byte) ([]byte, error)Transform returns the RFC 8785 canonical encoding of the JSON text data, parsed with jsonvalue.DefaultLimits.
TransformWithLimits
Section titled “TransformWithLimits”func TransformWithLimits(data []byte, l jsonvalue.Limits) ([]byte, error)TransformWithLimits is Transform with explicit parsing limits.
type NumberError
Section titled “type NumberError”type NumberError struct { Text string}NumberError reports a JSON number that has no finite IEEE 754 double.
NumberError.Error
Section titled “NumberError.Error”func (e *NumberError) Error() string