jsonutils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jsonutils defines utilities for working with JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintJSONOn

func PrintJSONOn(data any, writer io.Writer) error

PrintJSONOn pretty-prints the given data as JSON on the given writer. If the given data is not valid JSON an error is returned.

func ToJSON

func ToJSON(data any) result.Result[string]

ToJSON returns a pretty-printed JSON string for the given data. If the given data is not valid JSON an error is returned. If you are marshaling a large data structure and are concerned about the performance of iteratively growing the destination strings.Builder then create your own builder, grow it to your expected size, and then call PrintJSONOn.

func UnmarshalFromReader

func UnmarshalFromReader(reader io.Reader, instance any) error

UnmarshalFromReader inflates the JSON in the given reader and populates the given instance. If the data in the reader is not valid JSON an error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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