Open
Description
ScalarMarshaler
and ScalarUnmarshaler
interfaces were added to the encoding package in golang/go:
- https://go-review.googlesource.com/c/go/+/553175
- JSON: https://go-review.googlesource.com/c/go/+/553176
- GOB: https://go-review.googlesource.com/c/go/+/569276
- XML: https://go-review.googlesource.com/c/go/+/568896
Description from https://go-review.googlesource.com/c/go/+/553176
encoding/json: handle encoding.ScalarMarshaler and encoding.ScalarUnmarshaler
Per discussion on https://go.dev/issue/56235, Marshal checks for ScalarMarshaler strictly
after TextMarshaler, and Unmarshal delegates to TextUnmarshaler or
ScalarUnmarshaler according to whether the corresponding JSON value is a
string, Boolean, or number. Neither function handles a complex128 type
argument to the interfaces.