json

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentType = "Content-Type"

	TextHTML        = "text/html"
	ApplicationJSON = "application/json"
)

Variables

This section is empty.

Functions

func Decode added in v1.0.0

func Decode[T any](r io.Reader) (T, error)

Same as func DecodeInto, but initziliazes new var of T.

func DecodeInto added in v1.0.0

func DecodeInto[T any](r io.Reader, target *T) error

Can be called when already having a var of type T. Unmarshals data into the target.

func Encode added in v1.0.0

func Encode(w io.Writer, v any) error

A wrapper for json data encoding.

func Write added in v1.0.0

func Write(w http.ResponseWriter, s int, v any) error

A func that can be used in handlers to write JSON. Includes status code and structured data to marshall.

Types

This section is empty.

Jump to

Keyboard shortcuts

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