Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

felicia00's avatar

How to read array within array

Hello currently i am facing a problem which is how can i get data from array in array from API? the console log shows that i have 3 array in my API and right now i wish to get is the first array's data (my_info). & i would like to display all the data in my web . Appreciate alot if someone can help me with this

script

 data: () => ({ 
mydetails:[]
}),
methods:{
 getUserDetails(){      
  
            
                 axios.get('/api/profile/get_my_info',{
                    params:{
                        id_customer:this.user_id
                    }   
                })
                
                 .then((response) => response.data)
                 .then((response) => {
                      this.mydetails = response.data.result;
                      console.log(this.mydetails[0])                                                     
                    })                 
                 .catch((error) => {
                     let error_msg = error.response.message;
                     console.log(error);
                     this.error_msg = error_msg;
                     this.$bvToast.toast(error_msg,{ variant:'danger', noCloseButton: true, solid:true})
                     
                 });                
            },    
}   

console.log

{__ob__: Observer}
my_info: Array(1)
0
: 
{…}
length
: 
1
__ob__
: 
Observer {value: Array(1), shallow: false, mock: false, dep: Dep, vmCount: 0}
[[Prototype]]
: 
Array
done_used: Array(0)
undone_used: Array(3)
0 likes
0 replies

Please or to participate in this conversation.