json

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package json provides JSON encoding/decoding utilities.

Index

Constants

This section is empty.

Variables

View Source
var Unmarshal = json.Unmarshal

Unmarshal is an alias for json.Unmarshal.

Functions

func Decode

func Decode(body io.ReadCloser, dst interface{}) error

Decode reads and unmarshals from an io.ReadCloser.

func DecodeBuffer

func DecodeBuffer(buf *bytes.Buffer, dst interface{}) error

DecodeBuffer unmarshals from a buffer.

func DecodeBytes

func DecodeBytes(data []byte, dst interface{}) error

DecodeBytes unmarshals from bytes.

func Encode

func Encode(value interface{}) string

Encode marshals a value to a JSON string.

func EncodeBuffer

func EncodeBuffer(value interface{}) *bytes.Buffer

EncodeBuffer marshals to a bytes.Buffer.

func EncodeBytes

func EncodeBytes(value interface{}) []byte

EncodeBytes marshals a value to JSON bytes.

func EncodeIndentBytes

func EncodeIndentBytes(value interface{}, prefix, indent string) []byte

EncodeIndentBytes marshals with custom indentation.

func EncodeRaw

func EncodeRaw(value interface{}) json.RawMessage

EncodeRaw marshals to json.RawMessage.

func Iterator

func Iterator(filename string) <-chan Record

Iterator reads an NDJSON file and returns records via channel.

Types

type Record

type Record struct {
	Data  string
	Index int
}

Record holds a line of NDJSON data.

Jump to

Keyboard shortcuts

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