Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

json

v0.5.39
webtyp.com/json

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

7 matches

Top ↑

Functions

Decode

func Decode(input any, data model.Decodable) error

Decode parses JSON into a Decodable. input: []byte | string | Reader.

Encode

func Encode(data model.Encodable, output any) error

Encode serializes an Encodable to JSON. output: *[]byte | *string | Writer.

Keys

func Keys(object string) ([]string, error)

Keys returns the names of a JSON object's fields, in the order they appear: for reading an object whose field names are data, such as the "properties" of a JSON Schema. Decode reads fields whose names the code already knows.

Types

Reader

type Reader interface {
	Read(p []byte) (n int, err error)
}

Reader is io.Reader redeclared here, for the same reason as Writer.

Writer

type Writer interface {
	Write(p []byte) (n int, err error)
}

Writer is io.Writer redeclared here. Structurally identical, so any io.Writer satisfies it without the caller changing a line.

Dependency graph