Open
Description
JSON serialization is very commonly used in HTTP servers where use of net/http
means that the user typically starts with a io.Reader
and io.Writer
on hand. As such, it is slightly inconvenient using protojson
since it operates primarily on []byte
.
Perhaps we should add MarshalWriter
that takes in a io.Writer
as input and a UnmarshalReader
that takes in a io.Reader
as input.
Consideration needs to be given to:
- proto: add scatter/gather API for serialization #609 which considers adding APIs to the
proto
package to support streaming read/write and/or scatter/gather functionality. - encoding/json: the Decoder.Decode API lends itself to misuse go#36225, where the typical pattern of doing
json.NewDecoder(r).Decode(...)
is subtly buggy since it permits trailing trash data to go undetected.
(We would probably do the equivalent change to prototext
since the two packages have nearly identical API surface despite having obviously different semantic behavior).
Metadata
Metadata
Assignees
Labels
No labels