You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Deprecated: Custom types should implement protobuf reflection instead.
typeJSONPBMarshalerinterface {
MarshalJSONPB(*Marshaler) ([]byte, error)
}
The deprecation comment says to use protobuf reflection, but assuming that I do discover how to completely implement my own message without relying on protoc, I don't see how I can use reflection to have the json structure be different from the proto message structure (as is the case with several well known types)
I am assuming that the comment The JSON marshaling must follow the proto to JSON specification: implies that serialization to json should not utilize arbitrary structure, and that the ability to do this as been dropped from the current library, but I would just like to make sure.
The text was updated successfully, but these errors were encountered:
There is no way to override the JSON representation for specific messages in encoding/protojson.
The purpose of this package is to (de)serialize messages in the standard protobuf JSON encoding, which is supported by many different implementations in many different languages. Custom encodings for specific messages would prevent cross-implementation interoperability.
As was possible in jsonpb?
protobuf/jsonpb/encode.go
Lines 53 to 63 in ae97035
The deprecation comment says to use protobuf reflection, but assuming that I do discover how to completely implement my own message without relying on protoc, I don't see how I can use reflection to have the json structure be different from the proto message structure (as is the case with several well known types)
I am assuming that the comment
The JSON marshaling must follow the proto to JSON specification:
implies that serialization to json should not utilize arbitrary structure, and that the ability to do this as been dropped from the current library, but I would just like to make sure.The text was updated successfully, but these errors were encountered: