Upon receiving our GET request, the response is as follows:
{
"access_token": "pi7ID4bsZIC9yN ... 76gnblw",
"token_type": "bearer",
"expires_in": 1209599,
"userName": "super0",
"userRoles": "["member", "admin"]",
".issued": "Tue, 04 Feb 2014 05:07:51 GMT",
".expires": "Tue, 18 Feb 2014 05:07:51 GMT"
}
An issue arises when AngularJS transforms it into this object.
data: Object
.expires: "Tue, 18 Feb 2014 05:07:51 GMT"
.issued: "Tue, 04 Feb 2014 05:07:51 GMT"
access_token: "pi7ID4bsZIC9yN ... 76gnblw"
expires_in: 1209599
token_type: "bearer"
userName: "super0"
userRoles: "["member", "admin"]"
__proto__: Object
The challenge lies in converting "userRoles" from a string to a JavaScript array. What solutions are available for this problem?