Jeffail/gabs

If i want to detect the type array or object ,how to differentiate ?

chandraanwar91 opened this issue · 1 comments

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
}