'How to make multi-dementional arrays with array lists wiht axios and vue js
I am quite new to the axios and javascript and I am so confused with making multi-dimentional array.
1. I want my data to look like :
userList: [
{
user_no: 1,
user_nickname: "hailey",
},
{
user_no: 2,
user_nickname: "mandi",
},
{
user_no: 3,
user_nickname: "loren",
},
{
user_no: 4,
user_nickname: "james",
},
],
2. But from axios response, I am getting result like this :
{user_no : 1, user_nickname : "hailey"}
{user_no : 2 , user_nickname : "mandi"}
{user_no : 3 , user_nickname : "loren"}
{user_no : 4 , user_nickname : "james"}
How can I wrap those individual lists into multi dimentional array so I can make #2 -> #1 ? I saw some functions like flat which does the opposite of what I want. So I was wondering if there's any way like those to wrap all arrays with outer array.
Solution 1:[1]
I was being stupid. As the answer above said, there is nothing wrong with my data or code. But when I was getting data, the objects are actually insde the data so the structure was like this :
response.data.data //i was calling it response.data ^^:;
Thank you for help :D
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mercy |



