json

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package json provides helper functions for working with json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(o interface{}) ([]byte, error)

Marshal wraps the json.Marshal

func ReadJSON

func ReadJSON(filepath string) (obj map[string]interface{}, err error)

ReadJSON reads the target file and returns a map[string]interface{} data structure representing the json read in.

func Unmarshal

func Unmarshal(y []byte, o interface{}) error

Unmarshal wraps the json.Unmarshal

func WriteJSON

func WriteJSON(filepath string, obj interface{}, indent ...int) (err error)

WriteJSON converts the given obj interface{} into json then writes to disk with default permissions. Expects obj to be a structure that encoding/json understands

Types

This section is empty.

Jump to

Keyboard shortcuts

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