example

command
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 4 Imported by: 0

README

SilentJSON Quickstart Example

This directory contains a basic example demonstrating the core features of silentjson.

It covers two primary use cases:

  1. Parallel Unmarshaling: Reading an entire JSON array into memory extremely fast using UnmarshalArrayParallel.
  2. Stream Parsing: Reading a JSON array from an io.Reader using NewStreamDecoder and iterating over it with Next().

How to run

go run main.go

What you will learn

  • Registry Initialization: How to use silentjson.BuildRegistry(reflect.TypeOf(...)) once at the application startup to avoid reflection overhead during actual parsing.
  • Zero-Allocation Slices: Why silentjson requires you to provide a pre-allocated slice (e.g., make([]Employee, 2)).
  • Streaming Iterator: How decoder.Next() reuses a single struct pointer inside the callback, ensuring zero allocations during streaming.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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