jsonutil

package
v0.0.0-...-ae58740 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MPL-2.0 Imports: 13 Imported by: 3

Documentation

Overview

Package jsonutil provides utilities for parsing JSON files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

Decode decodes the result into data, requiring fields to match strictly and checking for trailing text. The reader is read to completion, even on error, so that HTTP response bodies are properly closed and connections can be reused.

func DecodeAllowUnknownFields

func DecodeAllowUnknownFields(r io.Reader, v interface{}) error

DecodeAllowUnknownFields decodes the result into data, checking for trailing text. The reader is read to completion, even on error, so that HTTP response bodies are properly closed and connections can be reused.

func DecodeFile

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

DecodeFile opens the given file and decodes the result into data, requiring fields to match strictly and checking for trailing text.

func DecodeFileAllowUnknownFields

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

DecodeFileAllowUnknownFields opens the given file and decodes the result into data, checking for trailing text.

func DecodeMozLz4

func DecodeMozLz4(r io.Reader, v interface{}) error

func DecodeMozLz4File

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

func DecompressMozLz4

func DecompressMozLz4(b []byte) ([]byte, error)

func QuotedUnmarshal

func QuotedUnmarshal(data []byte, v encoding.TextUnmarshaler) error

QuotedUnmarshal removes quotes then unmarshals the data. Escape sequences are not checked.

func UnmarshalMozLz4

func UnmarshalMozLz4(b []byte, v interface{}) error

Types

type Base64

type Base64 []byte

Base64 is a byte slice that is formatted in json as a base64 string.

func (Base64) MarshalJSON

func (b Base64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Base64) MarshalText

func (b Base64) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Base64) String

func (b Base64) String() string

func (*Base64) UnmarshalJSON

func (b *Base64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Base64) UnmarshalText

func (b *Base64) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Hex

type Hex []byte

Hex is a byte slice that is formatted in json as a hexadecimal string.

func (Hex) MarshalJSON

func (h Hex) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Hex) MarshalText

func (h Hex) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Hex) String

func (h Hex) String() string

func (*Hex) UnmarshalJSON

func (h *Hex) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Hex) UnmarshalText

func (h *Hex) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type UnknownObj

type UnknownObj struct{}

UnknownObj represents a json object for which the full type information is not known. Any unmarshal of a value that is not null or {} will raise an error. This is to ensure no data loss until all types have been determined.

func (*UnknownObj) UnmarshalJSON

func (u *UnknownObj) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Any unmarshal of a value that is not null will raise an error. This is to ensure no data loss until all types have been determined.

type UnknownType

type UnknownType struct{}

UnknownType represents a json value for which the full type information is not known. Any unmarshal of a value that is not null will raise an error. This is to ensure no data loss until all types have been determined.

func (*UnknownType) UnmarshalJSON

func (u *UnknownType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Any unmarshal of a value that is not null will raise an error. This is to ensure no data loss until all types have been determined.

Directories

Path Synopsis
Package timefmt provides types for representing time formats in JSON.
Package timefmt provides types for representing time formats in JSON.
Package uuid encodes and decodes UUIDs.
Package uuid encodes and decodes UUIDs.

Jump to

Keyboard shortcuts

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