jsonkey

package
v1.10.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package jsonkey defines canonical JSON object member names for DSL map keys.

Index

Constants

This section is empty.

Variables

View Source
var BooleanKeys = json.JoinOptions(
	json.WithMarshalers(json.MarshalToFunc[any](marshalBooleanKey)),
	json.WithUnmarshalers(json.UnmarshalFromFunc[any](unmarshalBooleanKey)),
)

BooleanKeys extends JSON encoding and decoding with canonical boolean map keys, named "true" and "false". Boolean values and types with custom JSON or text representations retain the JSON library's behavior.

Functions

func HasCustomEncoding

func HasCustomEncoding(valueType reflect.Type) bool

HasCustomEncoding reports whether JSON serialization owns the type's representation. JSON v2 also checks pointer methods on addressable copies.

func Name

func Name(key reflect.Value) (string, bool)

Name returns the JSON object member name of a string, boolean, or finite numeric map key, including named scalar types and interface wrappers. It reports false for nil, non-finite numbers, and unsupported key kinds.

func Value

func Value(value any) (any, error)

Value canonicalizes builtin map keys in an acyclic, captured value. Scalars retain precision and byte slices retain their JSON byte encoding. Custom encoders and maps with custom key encoders keep ownership of their wire form. Unsupported or colliding builtin keys are errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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