In a AngularJS environment I've got two JSON objects like the following:
var rowData = {
fields: {
Id: 1234,
Code: xyz
}
};
var access = {
0: "fields['Id']"
}
now I want to access the value of rowData.fields['Id'] generic by evaluating the value of access[0].
I tried:
var result = rowData.access[0]
which of course does not work. Problem seems to be that the value of access[0] is a string.
How do I convert this to being usable in this given scenario?
eval("rowData." + access[0]);