Description
Per #183:
There's several other parts of the proto3 JSON spec that make it impossible to use the standard encoding/json package, like WKTs.
I don't want to have generated protos grow any extra dependencies, so depending on the jsonpb package isn't appropriate.
I think json
usage is pervasive enough that we should revisit this decision. Message types whose JSON encoding diverges from the standard encoding/json
package should provide MarshalJSON
and UnmarshalJSON
methods. Then users could use the standard package without the need to explicitly interact with jsonpb
.
Yes, it's possible that would add a few more dependencies for programs that don't strictly need them. To the extent that that's a problem, it's a problem that should be fixed in the compiler and linker: the marginal increase in build and link times due to the extra dependencies seems like it would be miniscule compared to the complexity of interacting with two separate and incompatible packages for JSON encoding (e.g. #248).