In previous lectures, we have learned how to write protobuf messages and generate Go + Java codes from them. Today we will start using those codes to generate and serialise random protobuf messages to binary and JSON files. In this first half of the lecture, we will write Go codes to: Generate a random protobuf message (laptop object)., proto: Package proto provides functions operating on protobuf messages such as cloning, merging, and checking equality, as well as binary serialization. encoding/protojson: Package protojson serializes protobuf messages as JSON., Protobuf, being a binary format, is faster to serialize and deserialize than JSON. However, because it is not self-describing, it requires a schema to be available at both the serialization and, Covers how to use the Protobuf to JSON conversion utilities. Protobuf supports a canonical encoding in JSON, making it easier to share data with systems that do not support the standard protobuf binary wire format. ProtoJSON Format is not as efficient as protobuf wire format., Learn how to serialize and deserialize data in Golang using popular formats like JSON, XML, Gob, Protocol Buffers, MessagePack, and YAML in this latest guide., So, I need to marshal the array of proto into a json. For example, How do I marshal this protoResps? Currently, protojson.Marshal function can marshal ProtoResp but can't marshal []ProtoResp as its slice of proto. I also need to unmarshal this later back into []ProtoResp. Thanks in advance. have you try byts, err := json.Marshal (protoResps) ?.