it
dec.Decode(&i)
will call your UnmarshalJSON , which in turn will call Decode , etc. If you need to unmount JSON and then do something with it, one neat technique is to declare a local type, untie your data, and convert it back to the type you need:
Playground: http://play.golang.org/p/HWamV3MbvW .
Type a has no methods (therefore not), but convertible to a .
source share