jsonutil

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package jsonutil provides utility functions for working with JSON files, including secure file loading and pretty-printing of JSON data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFile

func LoadFile[T any](path string) (*T, error)

LoadFile reads a JSON file at the given path into a typed object.

Parameters:

  • path: the file path to read

Returns:

  • *T: pointer to the decoded object
  • error: if the file cannot be read or decoded

func PrettyJSON

func PrettyJSON[T any](object T) (string, error)

PrettyJSON returns a pretty-printed JSON string representation of the given object.

Parameters:

  • object: the value to marshal as JSON

Returns:

  • string: the pretty-printed JSON
  • error: if marshaling fails

Types

This section is empty.

Jump to

Keyboard shortcuts

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