Sorry if the title is confusing, I'm confused my self.
So its like this, I get a string from api like this: 'data.data.type'.
And I need to turn it into this response['data]['data]['type'].
Any idea how I can achieve this?
Sorry if the title is confusing, I'm confused my self.
So its like this, I get a string from api like this: 'data.data.type'.
And I need to turn it into this response['data]['data]['type'].
Any idea how I can achieve this?
Assuming response is a single object , you can get the value of type
like this
var response = {
data: {
data: {
type: "Here is type"
}
}
}
console.log(response['data']['data']['type'])