jsonmember

package
v1.0.0-dev.16 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package jsonmember reads JSON documents member by member, by each member's JSON kind (RFC 8259).

Object decodes with encoding/json/v2 at its defaults, which refuses duplicate names and invalid UTF-8 at every depth, unread members included, and bounds the nesting (RFC 8259 §4, §8.1). A member is then read by its kind, never by decoding into a Go type, since json/v2 decodes null into a string, number or bool as the zero value with no error. So a null member is the wrong kind; a caller that reads null as absent checks for it itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array

func Array(v jsontext.Value) (vals []jsontext.Value, ok bool)

Array reads v, a value from Object, as a JSON array; ok is false for any other kind.

func Bool

func Bool(v jsontext.Value) (b, ok bool)

Bool reads v as a JSON true or false; ok is false for any other value.

func NumericDate

func NumericDate(v jsontext.Value) (t time.Time, ok bool)

NumericDate reads v as a NumericDate (RFC 7519 §2): a JSON number of seconds since the epoch, in [0, maxNumericDate], its fraction dropped. ok is false for any other value, null and a string included.

func Object

func Object(data []byte) (map[string]jsontext.Value, error)

Object decodes data as one JSON object, its members' values kept as JSON text. Any other document, null included, is an error.

func String

func String(v jsontext.Value) (s string, ok bool)

String reads v as a JSON string; ok is false for any other kind, null included, and for an absent member's nil value.

func Strings

func Strings(v jsontext.Value) ([]string, bool)

Strings reads v as a JSON array whose every entry is a string; ok is false for any other value, an array holding a null included.

Types

This section is empty.

Jump to

Keyboard shortcuts

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