Documentation
¶
Overview ¶
Package json wraps encoding/json as a codec.Codec implementation registered under Format("json"). Blank-importing this package is enough to make JSON resolvable via the core/codec registry.
Package json — range 0.3.2.* (ADR 0005 service/codec/json block).
Package json — adapts *encoding/json.Decoder to codec.Decoder.
Package json — adapts *encoding/json.Encoder to codec.Encoder.
Package json — declares the sentinel *errs.Error values used to wrap failures from encoding/json.
Index ¶
Constants ¶
const CodeJSONMarshalFailed errs.Code = 0x00_03_02_01 // 0.3.2.1
CodeJSONMarshalFailed identifies a failure inside encoding/json.Marshal.
const CodeJSONUnmarshalFailed errs.Code = 0x00_03_02_02 // 0.3.2.2
CodeJSONUnmarshalFailed identifies a failure inside encoding/json.Unmarshal.
Variables ¶
var ( // MarshalFailed wraps a failure from encoding/json.Marshal. MarshalFailed = errs.Define(CodeJSONMarshalFailed, "MARSHAL_FAILED", "JSON encoding failed", "service/codec/json: encoding/json.Marshal returned an error") // UnmarshalFailed wraps a failure from encoding/json.Unmarshal. UnmarshalFailed = errs.Define(CodeJSONUnmarshalFailed, "UNMARSHAL_FAILED", "JSON decoding failed", "service/codec/json: encoding/json.Unmarshal returned an error") )
var Codec codec.Codec = codec.Register(&jsonCodec{})
Codec is the JSON singleton, registered with core/codec at package load. Binding the registration result to a named var is more idiomatic than `var _ = codec.Register(...)` and keeps us clear of init().
Functions ¶
Types ¶
This section is empty.