0
data = {
active: false
address: {
   address_1: '123 Main St', 
   address_2: 'Unit 1', 
   city: 'San Diego', 
   country: 'US', 
   postal_code: '92126'
}
created_at: "2022-05-23T21:28:10.545Z"
created_by: null
id: 1
type: "physical"
updated_at: "2022-05-28T08:09:08.337Z"
warehouse_aliases: []
}

I have a object as above, I want to access the data.address.country dynamically let's say the dynamic value x = "address.country". However, when I try to get the value like data[x] it didn't work. How can I get the value ? Thanks a lot for any answer :)

0 Answers0