json_stream_decoder

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONStreamDecoder

type JSONStreamDecoder struct {
	// contains filtered or unexported fields
}

JSONStreamDecoder incrementally decodes JSON objects and emits plain text representations of their values. The decoder is tolerant to truncated payloads and will emit any partial content it was able to decode before returning an error.

func NewJSONStreamDecoder

func NewJSONStreamDecoder(r io.Reader) *JSONStreamDecoder

NewJSONStreamDecoder creates a JSONStreamDecoder that reads tokens from r.

func (*JSONStreamDecoder) Stream

func (d *JSONStreamDecoder) Stream(out func(string) error) error

Stream parses the JSON object and invokes out for each chunk of plain text representation.

type PartialJSONError

type PartialJSONError struct {
	Err error
}

PartialJSONError indicates that the decoder encountered an error after emitting at least one chunk of output.

func (*PartialJSONError) Error

func (e *PartialJSONError) Error() string

Error implements the error interface.

func (*PartialJSONError) Partial

func (e *PartialJSONError) Partial() bool

Partial reports that some output was emitted before the error occurred.

func (*PartialJSONError) Unwrap

func (e *PartialJSONError) Unwrap() error

Unwrap returns the wrapped error.

Jump to

Keyboard shortcuts

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