Back to godoc.org
github.com/hashicorp/vault/sdk / helper / jsonutil

package jsonutil

v0.1.13
Latest Go to latest
Published: Jul 25, 2019 | License: MPL-2.0 | Module: github.com/hashicorp/vault/sdk

Index

func DecodeJSON

func DecodeJSON(data []byte, out interface{}) error

DecodeJSON tries to decompress the given data. The call to decompress, fails if the content was not compressed in the first place, which is identified by a canary byte before the compressed data. If the data is not compressed, it is JSON decoded directly. Otherwise the decompressed data will be JSON decoded.

func DecodeJSONFromReader

func DecodeJSONFromReader(r io.Reader, out interface{}) error

Decodes/Unmarshals the given io.Reader pointing to a JSON, into a desired object

func EncodeJSON

func EncodeJSON(in interface{}) ([]byte, error)

Encodes/Marshals the given object into JSON

func EncodeJSONAndCompress

func EncodeJSONAndCompress(in interface{}, config *compressutil.CompressionConfig) ([]byte, error)

EncodeJSONAndCompress encodes the given input into JSON and compresses the encoded value (using Gzip format BestCompression level, by default). A canary byte is placed at the beginning of the returned bytes for the logic in decompression method to identify compressed input.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier