unmarshalling arbitrary data
You can unmarshall bottom half in json.RawMessage first, something like package main import ( “encoding/json” “fmt” ) type Message struct { Code int Payload json.RawMessage // delay parsing until we know the code } type Range struct { Start int End int } type User struct { ID int Pass int } func MyUnmarshall(m []byte) … Read more