jsonutils

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package jsonutils provides essential JSON utilities. Making JSON less painful, one function at a time

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(reader io.Reader, v interface{}) error

Decode reads JSON from reader.

func Encode

func Encode(writer io.Writer, v interface{}) error

Encode writes JSON to writer.

func FromJSON

func FromJSON(jsonStr string, v interface{}) error

FromJSON parses JSON string into provided value.

func FromJSONFile

func FromJSONFile(filename string, v interface{}) error

FromJSONFile reads JSON file into provided value.

func IsValidJSON

func IsValidJSON(jsonStr string) bool

IsValidJSON checks if string is valid JSON. Spoiler alert: most strings are not

func ToJSON

func ToJSON(v interface{}) (string, error)

ToJSON converts any value to JSON string.

func ToJSONFile

func ToJSONFile(filename string, v interface{}) error

ToJSONFile writes value to JSON file.

func ToPrettyJSON

func ToPrettyJSON(v interface{}) (string, error)

ToPrettyJSON converts any value to formatted JSON.

Types

This section is empty.