Skip to content

Commit

Permalink
Merge pull request #2170 from dennisrijsdijk/patch-1
Browse files Browse the repository at this point in the history
Update $arrayElement to return as string
  • Loading branch information
itsjesski authored Sep 15, 2023
2 parents 477a678 + 0d09901 commit 7b95371
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,11 +15,16 @@ const model = {
if (jsonArray) {
const array = utils.jsonParse(jsonArray);
if (Array.isArray(array)) {
// 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;
}
};

module.exports = model;
module.exports = model;

0 comments on commit 7b95371

Please sign in to comment.