jsonfinite

package
v1.0.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package jsonfinite is the read-side inverse of types.MarshalFinite.

The wire writes an undefined figure — NaN / ±Inf in Go — as JSON null in place. encoding/json decodes that null into a non-pointer float slot as a no-op, so a result read back from its own JSON would carry 0 where the engine reported "undefined", and a reader would take the 0 for a real figure. Unmarshal restores NaN there instead.

It is for decoding RESULTS (a Response, ComposedResponse, ChainResponse, FacetResult) a caller hands back — the CLI's `pulse explain --response` and MCP `pulse_explain`. A request is decoded with plain encoding/json: a null request float means "unset", never "undefined".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

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

Unmarshal is json.Unmarshal plus one rule: a JSON null that lands in a non-pointer float slot — a struct field, a slice or array element, a map value — is NaN, not 0. A pointer slot stays nil (encoding/json already keeps that null), an `any` slot stays nil, and a value whose type decodes itself (json.Unmarshaler / encoding.TextUnmarshaler) is left as its own decoder made it. Input holding no null decodes exactly as json.Unmarshal decodes it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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