Go JSON unmarshaling based on an enumerated field value

In a previous article , we talked about marshaling/unmarshaling JSON with a structure like

	"type": "this part tells you how to interpret the message",
	"msg": ...the actual message is here, in some kind of json...

Last time, we left a repetitive switch statement in the code, where each message type was unmarshaled very explicitly. This time, we'll talk about ways to clean that up.


2020-01-21T20:49:33-07:00, originally published 2016-01-12T15:54:27-08:00