jsonutil

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 3 Imported by: 0 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

Overview

Package jsonutil provides the project's standard-compatible JSON API. It uses Sonic on supported 64-bit architectures and encoding/json elsewhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

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

Marshal returns the JSON encoding of value using Sonic's standard-compatible configuration.

func MarshalIndent

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

MarshalIndent returns the indented JSON encoding of value using Sonic's standard-compatible configuration.

func Unmarshal

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

Unmarshal decodes data into value using Sonic's standard-compatible configuration.

func Valid

func Valid(data []byte) bool

Valid reports whether data is a valid JSON encoding.

Types

type Decoder added in v0.15.1

type Decoder interface {
	Decode(any) error
	Buffered() io.Reader
	DisallowUnknownFields()
	More() bool
	UseNumber()
}

Decoder describes the streaming decoder operations used by the project.

func NewDecoder

func NewDecoder(reader io.Reader) Decoder

NewDecoder returns a standard-compatible Sonic streaming decoder.

type Encoder added in v0.15.1

type Encoder interface {
	Encode(any) error
	SetEscapeHTML(bool)
	SetIndent(string, string)
}

Encoder describes the streaming encoder operations used by the project.

func NewEncoder

func NewEncoder(writer io.Writer) Encoder

NewEncoder returns a standard-compatible Sonic streaming encoder.

type RawMessage

type RawMessage = stdjson.RawMessage

RawMessage is a raw encoded JSON value.

Jump to

Keyboard shortcuts

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