Help us shape the future of Go! Take the 2026 Go Developer Survey

strictjson

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Overview

Package strictjson rejects text encodings that Go's JSON decoders would otherwise repair lossily before callers can enforce exact-text guarantees.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUTF8      = errors.New("JSON text is not valid UTF-8")
	ErrInvalidSurrogate = errors.New("JSON text contains an invalid Unicode surrogate escape")
)

Functions

func ValidateText

func ValidateText(data []byte) error

ValidateText checks raw JSON text for valid UTF-8 and correctly paired UTF-16 surrogate escapes. The normal JSON decoder remains responsible for all other syntax validation.

func ValidateUniqueKeys added in v0.1.6

func ValidateUniqueKeys(data []byte) error

ValidateUniqueKeys rejects object members that encoding/json could overwrite while decoding. Case-folded aliases count as duplicates because struct field matching is case-insensitive. Keys in separate objects remain independent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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