json

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalCompact added in v0.5.0

func MarshalCompact(v any) ([]byte, error)

MarshalCompact encodes v on one line with HTML escaping, like json.Marshal, writing keys in recorded order when key order preservation is enabled.

func NormalizeNumbers added in v0.5.0

func NormalizeNumbers(value any) (any, error)

NormalizeNumbers replaces json.Number values with int when they are whole numbers within int range, and float64 otherwise.

func Unmarshal added in v0.5.0

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

Unmarshal decodes a single JSON value. Generic destinations receive int for integers, because decoding them as float64 corrupts values above 2^53.

func UnmarshalAll added in v0.5.0

func UnmarshalAll(data []byte) ([]any, error)

UnmarshalAll decodes a stream of whitespace-separated JSON values, keeping integers exact like Unmarshal.

Types

type Codec

type Codec struct{}

func (*Codec) Marshal

func (c *Codec) Marshal(v any) ([]byte, error)

func (*Codec) Unmarshal added in v0.5.0

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

Unmarshal decodes JSON, keeping integers exact for generic destinations.

Jump to

Keyboard shortcuts

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