jsonutil

package
v0.0.0-...-30c4fd9 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package jsonutil provides functions for working with JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Indent

func Indent(data []byte, v interface{}, prefix, indent string) ([]byte, error)

Indent a json string by unmarshalling it and marshalling it with MarshalIndent.

The data will be unmarshalled in to v, which must be a pointer. Example:

Indent(`{"a": "b"}`, &map[string]string{}, "", "  ")

func MustIndent

func MustIndent(data []byte, v interface{}, prefix, indent string) []byte

MustIndent behaves like Indent but will panic on errors.

func MustMarshal

func MustMarshal(v interface{}) []byte

MustMarshal behaves like json.Marshal but will panic on errors.

func MustMarshalIndent

func MustMarshalIndent(v interface{}, prefix, indent string) []byte

MustMarshalIndent behaves like json.MarshalIndent but will panic on errors.

func MustUnmarshal

func MustUnmarshal(data []byte, v interface{})

MustUnmarshal behaves like json.Unmarshal but will panic on errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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