jsonutils

package
v0.0.0-...-4cd9e82 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: BSD-3-Clause Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalStringMap

func MarshalStringMap(m map[string]string) (data []byte)

MarshalStringMap turns the given string map into a []byte slice that is the JSON encoded version of that map. It will produce the same output as json.Marshal. This includes the keys being sorted lexicographically. Unlike json.Marshal, it does not return an error because the errors json.Marshal could return (e.g. for cyclic data) do not apply.

Types

type Number

type Number int64

Number is an int64 which may be unmarshaled from a JSON string.

func (*Number) UnmarshalJSON

func (n *Number) UnmarshalJSON(data []byte) error

UnmarshalJSON parses data as an integer, whether data is a number or string.

type Time

type Time time.Time

Time is a convenience type used for unmarshaling a time.Time from a JSON- encoded timestamp in microseconds.

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

MarshalJSON encodes a time.Time as a JSON number of microseconds.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a time.Time from a JSON number of microseconds.

Jump to

Keyboard shortcuts

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