json

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package json is the JSON codec. It exists for two reasons: to prove the codec port with a second syntax, and for a deployment whose manifests live in a database or come from tools that speak JSON more readily than YAML. Files are written indented, two spaces, keys in the order the encoder sorts them, so a save is stable across runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec struct{}

Codec is the JSON codec. The zero value is ready to use.

func New

func New() Codec

New returns the JSON codec.

func (Codec) Decode

func (Codec) Decode(text []byte) (map[string]any, error)

func (Codec) DecodeAll

func (c Codec) DecodeAll(text []byte) ([]codec.Document, error)

DecodeAll: a JSON text is one manifest.

func (Codec) DecodeInto

func (Codec) DecodeInto(text []byte, v any) error

DecodeInto decodes through the generic document and YAML's field mapping, so the engine's typed views (which carry `yaml` tags) read a JSON manifest without a second set of tags. JSON is a subset of YAML 1.2, so this is a faithful read, at the cost of one extra pass.

func (Codec) Encode

func (Codec) Encode(v any) ([]byte, error)

func (Codec) Extension

func (Codec) Extension() string

func (Codec) Name

func (Codec) Name() string

Jump to

Keyboard shortcuts

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