ordered

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ordered writes JSON objects whose keys keep the order they were given in. A map would sort them, and the order of the options, the levels and the questions a classifier sends is part of what it asks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Indent

func Indent(v any) (string, error)

Indent encodes v as JSON indented by two spaces, without escaping HTML: how structured data is written into text a model reads.

func Marshal

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

Marshal encodes v as JSON without escaping HTML, so text reads as it was written.

Types

type Field

type Field struct {
	Key   string
	Value any
}

Field is one key and its value.

type Object

type Object []Field

Object is a JSON object whose keys are written in the order they were added.

func (Object) Keys

func (o Object) Keys() []string

Keys is the keys, in order.

func (Object) MarshalJSON

func (o Object) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, writing the keys in order.

func (*Object) Set

func (o *Object) Set(key string, value any)

Set adds a key, or replaces its value when it is already there.

Jump to

Keyboard shortcuts

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