json: cannot unmarshal object into Go value of type []string
{
"total": 2,
"users": [{
"email": "[email protected]",
"email_verified": false,
"user_id": "auth0|5a7be5b6620e9c452a18c4c5",
"picture": "https://s.gravatar.com/avatar/61cdbcb04d99fd3d37ec490366416bd3?s=480&r=pg&d=https://cdn.auth0.com/avatars/hs.png",
"nickname": "xxx",
"identities": [{
"user_id": "5a7be5b6620e9c452a18c4c5",
"provider": "auth0",
"connection": "Username-Password-Authentication",
"isSocial": false
}],
"updated_at": "2018-02-08T05:53:47.740Z",
"created_at": "2018-02-08T05:52:54.535Z",
"name": "[email protected]",
"last_ip": "101.26.151.153",
"last_login": "2018-02-08T05:53:47.740Z",
"logins_count": 1
}, {
"email": "[email protected]",
"email_verified": false,
"user_id": "auth0|5a7f21c35c679b17810dee65",
"picture": "https://s.gravatar.com/avatar/88502b57e6a1151ca2b5ba83e0e09480?s=480&r=pg&d=https://cdn.auth0.com/avatars/al.png",
"identities": [{
"connection": "Username-Password-Authentication",
"user_id": "5a7f21c35c679b17810dee65",
"provider": "auth0",
"isSocial": false
}],
"updated_at": "2018-02-10T16:45:55.954Z",
"created_at": "2018-02-10T16:45:55.954Z"
}]
}
The above JSON string cannot be loaded into []string. I also add a panic here and the whole error stack is here:
panic: json: cannot unmarshal object into Go value of type []string [recovered]
panic: json: cannot unmarshal object into Go value of type []string
goroutine 5 [running]:
testing.tRunner.func1(0xc0420ec0f0)
C:/Go/src/testing/testing.go:711 +0x2d9
panic(0x694a00, 0xc04236e280)
C:/Go/src/runtime/panic.go:491 +0x291
github.com/zenoss/go-auth0/auth0.readAndUnmarshal(0x2e00000, 0xc042196780, 0x6743c0, 0xc042378280, 0xc042196780, 0x18)
C:/GoPath/src/github.com/zenoss/go-auth0/auth0/auth0.go:154 +0x1d9
github.com/zenoss/go-auth0/auth0.(*Auth0).Do(0xc042072c30, 0xc0422a4300, 0x6743c0, 0xc042378280, 0x0, 0x0)
C:/GoPath/src/github.com/zenoss/go-auth0/auth0/auth0.go:182 +0x2be
github.com/zenoss/go-auth0/auth0/authz.(*AuthorizationService).Do(0xc04203c800, 0xc0422a4300, 0x6743c0, 0xc042378280, 0x831fc0, 0x887a78)
C:/GoPath/src/github.com/zenoss/go-auth0/auth0/authz/authz.go:55 +0x58
github.com/zenoss/go-auth0/auth0/authz.(*AuthorizationService).Get(0xc04203c800, 0xc0422a2cc0, 0x38, 0x6743c0, 0xc042378280, 0x6ed9e8, 0x8)
C:/GoPath/src/github.com/zenoss/go-auth0/auth0/authz/authz.go:64 +0x127
github.com/zenoss/go-auth0/auth0/authz.(*GroupsService).GetMembers(0xc04203ac70, 0xc042114870, 0x24, 0x6, 0xc0420fe308, 0x1, 0x0, 0x0)
C:/GoPath/src/github.com/zenoss/go-auth0/auth0/authz/groups.go:102 +0xe4
github.com/casbin/auth0-role-manager.(*RoleManager).getAuth0GroupUsers(0xc0420e6230, 0x6ed46e, 0x6, 0x0, 0xc042072a80, 0xc04201a000, 0x7aa030, 0x7aa070)
C:/GoPath/src/github.com/casbin/auth0-role-manager/role_manager.go:133 +0x162
github.com/casbin/auth0-role-manager.NewRoleManager(0x6f678b, 0x20, 0x6fcfb5, 0x40, 0x6ed8a8, 0x7, 0x6fccfe, 0x3e, 0xc005e55060, 0x7a6729)
C:/GoPath/src/github.com/casbin/auth0-role-manager/role_manager.go:64 +0x1a2
github.com/casbin/auth0-role-manager.TestEnforcer(0xc0420ec0f0)
C:/GoPath/src/github.com/casbin/auth0-role-manager/role_manager_test.go:87 +0x80
testing.tRunner(0xc0420ec0f0, 0x701bd0)
C:/Go/src/testing/testing.go:746 +0xd7
created by testing.(*T).Run
C:/Go/src/testing/testing.go:789 +0x2e5