jsonstrict

package
v0.0.0-...-d3a3bb4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package jsonstrict provides JSON unmarshaling that detects unknown fields.

Standard encoding/json silently ignores unknown JSON keys. For security-critical payloads like TEE attestation responses, silent drops mean API format changes go unnoticed. Unmarshal returns the names of unknown fields alongside the decoded value, letting callers decide how to handle format drift.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(data []byte, v any) (unknownFields []string, err error)

Unmarshal unmarshals data into v and returns the names of any JSON keys not represented by a json struct tag on v's type. Unknown fields never cause an error — only the normal json.Unmarshal error (if any) is returned.

v must be a non-nil pointer to a struct. Any other type panics.

Types

This section is empty.

Jump to

Keyboard shortcuts

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