Handle Array Indexing Within Dictionary
Closed this issue · 1 comments
Describe the solution you'd like
If a user specifies a dictionary containing an array and then an index, JIIM should be able to identify this and use indexing to continue into the array values.
e.g.
data[event][myDictionary][anArray][-1][anotherDictKey]
Where anArray is an array, and so [-1] should be treated as an index, not as a key.
Describe alternatives you've considered
It is possible to use the index function for this:
index(index(data[event][myDictionary][anArray],-1),anotherDictKey)
But this is harder to read and gets messy for heavily nested dictionary/array variables.
Additional context
Speed may be impacted so tests should be done to see how impacting this change might be.
Added a second check for nested dict failures that take into account lists within dicts, because it only happens on failure it wont be called unless needed reducing the overall performance impact of the additional code.
Penalty is 0.00005 seconds per event processed with i7 and cpuSaver disabled.