Skip to content

Commit

Permalink
Fix non-object and non-array being stringified
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisrijsdijk authored Jun 6, 2023
1 parent 6fc25d3 commit 0d09901
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/backend/variables/builtin/array-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ const model = {
if (jsonArray) {
const array = utils.jsonParse(jsonArray);
if (Array.isArray(array)) {
return JSON.stringify(array[index]);
// Check value for being array or object, otherwise return raw value
if (Array.isArray(array[index]) || Object.prototype.toString.call(array[index]) == "[object Object]")
{
return JSON.stringify(array[index]);
}
return array[index];
}
}
return null;
Expand Down

0 comments on commit 0d09901

Please sign in to comment.