json-decode.go
func decodeInterfaceJSON(bz []byte) (name string, data []byte, err error) {
	dfw := new(disfixWrapper)
	err = json.Unmarshal(bz, dfw)
	if err != nil {
		err = fmt.Errorf("cannot parse disfix JSON wrapper: %v", err)
		return
	}

	// Get name.
	if dfw.Name == "" {
		err = errors.New("JSON encoding of interfaces require non-empty type field.")
		return
	}
	name = dfw.Name

	// Get data.
	if len(dfw.Data) == 0 {
		err = errors.New("interface JSON wrapper should have non-empty value field")
		return
	}
	data = dfw.Data
	return
}
func decodeInterfaceJSON(bz []byte) (name string, data []byte, err error) {
	dfw := new(disfixWrapper)
	err = json.Unmarshal(bz, dfw)
	if err != nil {
		err = fmt.Errorf("cannot parse disfix JSON wrapper: %v", err)
		return
	}

	// Get name.
	if dfw.Name == "" {
		err = errors.New("JSON encoding of interfaces require non-empty type field.")
		return
	}
	name = dfw.Name

	// Get data.
	if len(dfw.Data) == 0 {
		err = errors.New("interface JSON wrapper should have non-empty value field")
		return
	}
	data = dfw.Data
	return
}
// decodeInterfaceJSON helps unravel the type name and
// the stored data, which are expected in the form:
// {
//    "type": "<canonical concrete type name>",
//    "value":  {}
// }