764
Views
1
Helpful
1
Replies
Evaluate Node - JavaScript error
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 02:04 AM
Anyone have any ideas why this gives an error in an webex connect evaluate node?
const originalArray = ["apple", "orange", "banana"];
const formattedArray = originalArray.map(fruit => ({ fruit }));
const myJson = JSON.stringify(formattedArray);
1;
It fails on line 2 - syntax error (<cmd>#2)
But the JavaScript looks OK? and the variable myJson should evaluate to:
[{"fruit":"apple"},{"fruit":"orange"},{"fruit":"banana"}]
Regards,
Gerry
Labels:
- Labels:
-
Platform
1 Reply 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 03:26 PM
Hi @Gerry O'Rourke - Arrow function is not supported by the JavaScript engine used for Webex Connect Evaluate node. You will need to define a function on your own to do the required data transformation/structuring in this case.
Tanuj Goyal
Webex Connect
Webex Connect
