I want to know if there is any way to convert a string to a var name without using eval.
I have the following json declared in a file:
{
"fields": {
"usr_language": {"var": "this.$i18n.locale", "value": null},
"token": {"var": "googleUser.getAuthResponse().id_token", "value": null}
}
}
When I import inside the component, I want to access fields.usr_language.alias.
Without using eval it returns the string “this.$i18n.locale”, obviously. Is there any way to get without using eval to get the values in variables? Is it unsafe to use eval in this cases?