json

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package json provides a pluggable JSON engine for Kruda. This file uses github.com/bytedance/sonic for SIMD-accelerated JSON processing. It is compiled by default when CGO is enabled and the kruda_stdjson tag is not set.

Index

Constants

View Source
const EncoderName = "sonic"

EncoderName identifies the active JSON encoder for diagnostics.

Variables

This section is empty.

Functions

func Marshal

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

Marshal encodes v as JSON using Sonic (SIMD-accelerated).

func MarshalToBuffer

func MarshalToBuffer(buf *bytes.Buffer, v any) error

MarshalToBuffer encodes v as JSON into the provided buffer using Sonic's streaming encoder. This avoids the intermediate []byte allocation that Marshal performs, enabling callers to reuse buffers via sync.Pool.

func Unmarshal

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

Unmarshal decodes JSON data into v using Sonic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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