Array & string in rest message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:11 AM
Hi all,
Can anyone please tell me on how to convert this into exact output as shown in image:
after split its not separated as double quotes with comma its working as M-23AL,M-35HM
so kindly request to help with this.
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 08:28 AM
@shalani r Use the following.
this.org = JSON.stringify(allOrg);
gs.info(this.org); //Will print the allOrg in the format you shared.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 10:02 PM - edited 12-12-2023 10:03 PM
Thanks for your response @Sandeep Rajput
After split i need to do JSON.stringify() ?
Regards,
Shalani R

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 10:43 PM
@shalani r No need for using split. Just use
this.org = JSON.stringify(allOrg);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 10:45 PM
Thanks for your response.
Its not working because the values from list collector variable if multiple values are selected its taking as single string.
For eg: If I select abc nd def - its taking as "abc,def"
but i need it as "abc", "def"
this is the issue i'm facing here.
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 11:00 PM
@shalani r List collector stores a comma separated string of elements. In this case you can use
this.org = JSON.stringify(allOrg.split(','));
gs.info(this.org);