jsonx

package
v0.0.0-...-19665b2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeValue

func DecodeValue(b []byte) (any, error)

DecodeValue materializes a JSON value tree while preserving number literals. It intentionally mirrors the token walk in etch's jsonSpanDecoder only at the syntax layer: jsonSpanDecoder records source byte spans for localized edits, while DecodeValue discards positions and keeps just semantic values.

func Marshal

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

func MarshalIndent

func MarshalIndent(v any, prefix, indent string) ([]byte, error)

func Unmarshal

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

func WriteIndented

func WriteIndented(w io.Writer, v any) error

Types

type Member

type Member struct {
	Name  string
	Value any
}

Member is one JSON object member in source order.

type Number

type Number string

Number is a JSON number literal preserved from source text.

func (Number) MarshalJSON

func (n Number) MarshalJSON() ([]byte, error)

type Object

type Object []Member

Object is a JSON object value that preserves source member order.

func (Object) MarshalJSON

func (o Object) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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