gabs
gabs copied to clipboard
If i want to detect the type array or object ,how to differentiate ?
Hey @chandraanwar91, the underlying value of an array or object is always []interface{}
and map[string]interface{}
respectively, therefore you can do something like this this for type switching:
switch gObj.Data().(type) {
case []interface{}:
// TODO
case map[string]interface{}:
// TODO
default:
// TODO
}