Documentation ¶
Overview ¶
Package encoding provides encoding features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalJSONArray ¶
MarshalJSONArray marshals a JSON array from values returned by the given function.
The given function returns the value, error, and a boolean telling whether a new value is present.
If the error is not nil, it stops marshalling and calls the function as long as it says a new value is present. That behavior is convenient to marshal channels, which are often needed to be drained to release resources.
func MarshalJSONObject ¶
MarshalJSONObject marshals a JSON object from values returned by the given function.
The given function returns the key, value, error, and a boolean telling whether a new value is present.
If the error is not nil, it stops marshalling and calls the function as long as it says a new value is present. That behavior is convenient to marshal channels, which are often needed to be drained to release resources.
Types ¶
type Time ¶
Time is a type representing a time and marshallable as JSON.
func ParseQueryTime ¶
ParseQueryTime parses time in URL query.
type ZeroString ¶
type ZeroString string
ZeroString is a string which should be marshalled as null if it has zero value.
func (ZeroString) MarshalJSON ¶
func (zeroString ZeroString) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the value.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type ZeroUint16 ¶
type ZeroUint16 uint16
ZeroUint16 is a uint16 which should be marshalled as null if it has zero value.
func (ZeroUint16) MarshalJSON ¶
func (zeroUint16 ZeroUint16) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the value.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON