how to deep marshal the block to JSON in fabric-protos-go-apiv2 #578
Replies: 2 comments
-
Protolator package looks to be implemented in terms of the deprecated v1 Golang protobuf API, whereas fabric-protos-apiv2 (as the name suggests) uses the v2 Golang protobuf API. You might be able to convert the v2 to a v1 message using proto.MessageV1 and then pass that to the protolator functions. I haven’t personally tried this and it might be that mixing the two versions of the Fabric protobuf messages in the same project will cause protobuf namespace conflicts. The closest thing to an out-of-the box solution is the protobuf protojson package, but this will of course not unpack nested serialised protobuf messages, which is exactly the issue with Fabric’s complicated protobuf structure that protolator aims to address. Perhaps the ideal solution would be for a v2 protolator package to implemented using the updated protobuf API and Fabric protobuf bindings. |
Beta Was this translation helpful? Give feedback.
-
yes, we cann't use two versions of the Fabric protobuf messages in the same project that will cause protobuf namespace conflicts. the old protolator util project sames deprecated hyperledger/fabric-config#53 Its a good idea to implements a v2 protolator package using the updated protobuf API and Fabric protobuf bindings. |
Beta Was this translation helpful? Give feedback.
-
In fabric-protos-go v1,we can use github.com/hyperledger/fabric-config/protolator to DeepMarshalJSON a block
In fabric-protos-go-apiv2 , how to Deep Marshal a block to json?
Beta Was this translation helpful? Give feedback.
All reactions