jsonz

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 3 Imported by: 4

Documentation

Overview

Package jsonz provides various utilities for working with JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustMarshal

func MustMarshal(v any) []byte

MustMarshal is like json.Marshal but panics on error.

func MustMarshalPretty

func MustMarshalPretty(v any) []byte

MustMarshalPretty is like json.MarshalIndent with prefix = "" and indent = " " but panics on error.

func MustMarshalPrettyString

func MustMarshalPrettyString(v any) string

MustMarshalPrettyString is like [MustMarshalIndent] but returns a string.

func MustMarshalString

func MustMarshalString(v any) string

MustMarshalString is like MustMarshal but returns a string.

func MustUnmarshal

func MustUnmarshal[T any](data []byte) T

MustUnmarshal is like Unmarshal but panics on error.

func MustUnmarshalString

func MustUnmarshalString[T any](data string) T

MustUnmarshalString is like UnmarshalString but panics on error.

func Unmarshal

func Unmarshal[T any](data []byte) (T, error)

Unmarshal is like json.Unmarshal but instantiates the target using a generic type.

func UnmarshalString

func UnmarshalString[T any](data string) (T, error)

UnmarshalString is like Unmarshal but accepts a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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