Working with a type class in my controller, I am currently parsing data and receiving it in the following format:
{
"data": {
"userList":[
{
"id":1,
"name":"soni"
}
]
},
"status":200,
"config":{
"method":"POST",
"transformRequest":[
null
],
"transformResponse":[
null
],
"url":"/home/main/module/userlist",
"headers":{
"rt":"ajax",
"Tenant":"Id:null",
"Access-Handler":"Authorization:null",
"Accept":"application/json, text/plain, */*"
}
},
"statusText":"OK"
}
While attempting to save this data, I used the following approach:
var userData = _data;
var newData = JSON.parse(userData).data.userList;
What is the best way to extract the user list into a new variable?