func InterfaceToFloat32(in interface{}) (float32, bool) {
	var ok bool
	if in, ok = JSONNumberToIntOrFloat(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return float32(casted), true
	case int16:
		return float32(casted), true
	case int32:
		return float32(casted), true
	case int:
		return float32(casted), true
	case int64:
		return float32(casted), true
	case float32:
		return casted, true
	case float64:
		return float32(casted), true
	}
	return 0, false
}
InterfaceToFloat32 will convert any int or float type
package cast
import (
	"encoding/json"
	"reflect"
)
func InterfaceToInt8(in interface{}) (int8, bool) {
	var ok bool
	if in, ok = JSONNumberToInt(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return casted, true
	case int16:
		if val := int8(casted); int16(val) == casted {
			return val, true
		}
	case int32:
		if val := int8(casted); int32(val) == casted {
			return val, true
		}
	case int:
		if val := int8(casted); int(val) == casted {
			return val, true
		}
	case int64:
		if val := int8(casted); int64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt8Downcast(in interface{}) (int8, bool) {
	var ok bool
	if in, ok = JSONNumberToIntOrFloat(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return casted, true
	case int16:
		if val := int8(casted); int16(val) == casted {
			return val, true
		}
	case int32:
		if val := int8(casted); int32(val) == casted {
			return val, true
		}
	case int:
		if val := int8(casted); int(val) == casted {
			return val, true
		}
	case int64:
		if val := int8(casted); int64(val) == casted {
			return val, true
		}
	case float32:
		if val := int8(casted); float32(val) == casted {
			return val, true
		}
	case float64:
		if val := int8(casted); float64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt16(in interface{}) (int16, bool) {
	var ok bool
	if in, ok = JSONNumberToInt(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int16(casted), true
	case int16:
		return casted, true
	case int32:
		if val := int16(casted); int32(val) == casted {
			return val, true
		}
	case int:
		if val := int16(casted); int(val) == casted {
			return val, true
		}
	case int64:
		if val := int16(casted); int64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt16Downcast(in interface{}) (int16, bool) {
	var ok bool
	if in, ok = JSONNumberToIntOrFloat(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int16(casted), true
	case int16:
		return casted, true
	case int32:
		if val := int16(casted); int32(val) == casted {
			return val, true
		}
	case int:
		if val := int16(casted); int(val) == casted {
			return val, true
		}
	case int64:
		if val := int16(casted); int64(val) == casted {
			return val, true
		}
	case float32:
		if val := int16(casted); float32(val) == casted {
			return val, true
		}
	case float64:
		if val := int16(casted); float64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt32(in interface{}) (int32, bool) {
	var ok bool
	if in, ok = JSONNumberToInt(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int32(casted), true
	case int16:
		return int32(casted), true
	case int32:
		return casted, true
	case int:
		if val := int32(casted); int(val) == casted {
			return val, true
		}
	case int64:
		if val := int32(casted); int64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt32Downcast(in interface{}) (int32, bool) {
	var ok bool
	if in, ok = JSONNumberToIntOrFloat(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int32(casted), true
	case int16:
		return int32(casted), true
	case int32:
		return casted, true
	case int:
		if val := int32(casted); int(val) == casted {
			return val, true
		}
	case int64:
		if val := int32(casted); int64(val) == casted {
			return val, true
		}
	case float32:
		if val := int32(casted); float32(val) == casted {
			return val, true
		}
	case float64:
		if val := int32(casted); float64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt(in interface{}) (int, bool) {
	var ok bool
	if in, ok = JSONNumberToInt(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int(casted), true
	case int16:
		return int(casted), true
	case int32:
		return int(casted), true
	case int:
		return casted, true
	case int64:
		if val := int(casted); int64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToIntDowncast(in interface{}) (int, bool) {
	var ok bool
	if in, ok = JSONNumberToIntOrFloat(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int(casted), true
	case int16:
		return int(casted), true
	case int32:
		return int(casted), true
	case int:
		return casted, true
	case int64:
		if val := int(casted); int64(val) == casted {
			return val, true
		}
	case float32:
		if val := int(casted); float32(val) == casted {
			return val, true
		}
	case float64:
		if val := int(casted); float64(val) == casted {
			return val, true
		}
	}
	return 0, false
}
func InterfaceToInt64(in interface{}) (int64, bool) {
	var ok bool
	if in, ok = JSONNumberToInt(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int64(casted), true
	case int16:
		return int64(casted), true
	case int32:
		return int64(casted), true
	case int:
		return int64(casted), true
	case int64:
		return casted, true
	}
	return 0, false
}
func InterfaceToInt64Downcast(in interface{}) (int64, bool) {
	var ok bool
	if in, ok = JSONNumberToIntOrFloat(in); !ok {
		return 0, false
	}
	switch casted := in.(type) {
	case int8:
		return int64(casted), true
	case int16:
		return int64(casted), true
	case int32:
		return int64(casted), true
	case int:
		return int64(casted), true
	case int64:
		return casted, true
	case float32:
		if val := int64(casted); float32(val) == casted {
			return val, true
		}
	case float64:
		if val := int64(casted); float64(val) == casted {
			return val, true
		}
	}
	return 0, false
}