I'm currently working on a generator for chartjs to help me with creating datasets.
My approach involves using object keys to extract data from each element in an array.
Each element in the array may contain nested objects like this:
https://i.sstatic.net/IXl3D.png
This nesting poses a challenge because accessing specific data, such as the name of the object feedback_skill, requires multiple levels of key referencing:
data.forEach(function (x) {
x['feedback_skill']['name']
});
This method isn't ideal for storing the accessed value in a single variable.
One alternative is to pass an array like this: serieKey = ['feedback', 'name']
, where each element corresponds to a key in the nested structure to access the desired value.
However, these datasets can be complex with potentially endless layers. So my question is:
Is there a more efficient way to achieve this?