We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Data Serialization

So far we've been using JSON to serialize our messages. "Serialization" is a fancy way to say "convert our struct into a format to be sent over the network". JSON is often a great choice because it's human-readable, easy to work with, and widely supported.

When you run into a problem, you can view the raw message in the Rabbit UI and read it. However, AMQP doesn't require you to use JSON, it works with raw bytes.

JSON isn't the most efficient way to serialize data, so when you're sending massive amounts of data, you might want to consider a more efficient format.

Gob

In Go, the standard library has a package called encoding/gob that can be used to serialize and deserialize data. It's more efficient than JSON, but it's not human-readable. It's a binary format that's faster to encode and decode.

Assignment

Complete the encode and decode functions.