orderedobject

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package orderedobject allows you to decode JSON dicts while preserving order. It uses the standard MarshalJSON and UnmarshalJSON interface and is thus compatible with most json encoders/decoders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Member

type Member[V any] struct {
	Key   string
	Value V
}

Member is a single key-value pair in an OrderedObject.

type OrderedObject

type OrderedObject[V any] []Member[V]

OrderedObject is a JSON dict that preserves order. Keys are strings, and values are generically typed V.

func (OrderedObject[V]) MarshalJSON

func (o OrderedObject[V]) MarshalJSON() ([]byte, error)

func (*OrderedObject[V]) UnmarshalJSON

func (o *OrderedObject[V]) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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