If i want to detect the type array or object ,how to differentiate ?
chandraanwar91 opened this issue · 1 comments
chandraanwar91 commented
If i want to detect the type array or object ,how to differentiate ?
Jeffail commented
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
}