- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2025 07:22 AM
I am getting the response in Client Script from the Script Include as below.
["5390f47f97e892545a4b31511153af96","2a21e73697709e901b85f0511153afce","42c87060471e46d0fcf52501e36d436f"]
I would like to convert it as below by removing the double quotes.
[5390f47f97e892545a4b31511153af96,2a21e73697709e901b85f0511153afce,42c87060471e46d0fcf52501e36d436f]
Please help me to achieve this by adding the piece of code in Script Include or Client Script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 05:51 AM
Below code worked.
var arr = ["5390f47f97e892545a4b31511153af96","2a21e73697709e901b85f0511153afce","42c87060471e46d0fcf52501e36d436f"];
arr = arr.toString().replaceAll('"',"").trim();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2025 07:35 AM
Once you post your Script Include and Client script, folks here will be able to assist. See:
10-tips-for-writing-a-quality-community-question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2025 07:48 AM
Hello @Bhaskar3
You can achieve this by parsing the JSON string and then converting it back to an array without quotes. Here's a simple way to do this in a Client Script:
var response = '["5390f47f97e892545a4b31511153af96","2a21e73697709e901b85f0511153afce","42c87060471e46d0fcf52501e36d436f"]';
// Parse the JSON string to an array
var parsedArray = JSON.parse(response);
// Convert the array to a string without quotes
var resultArray = parsedArray.map(function(item) {
return item;
});
//gs.log(resultArray); // Output: [5390f47f97e892545a4b31511153af96, 2a21e73697709e901b85f0511153afce, 42c87060471e46d0fcf52501e36d436f]
This script parses the JSON string into an array and then maps each item to a new array, effectively removing the quotes. The gs.log statement will display the array in the desired format.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 04:50 PM
Hello @Bhaskar3
Any issue with my solution provided?
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
As per new feature on community you can mark multiple answers as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 05:51 AM
Below code worked.
var arr = ["5390f47f97e892545a4b31511153af96","2a21e73697709e901b85f0511153afce","42c87060471e46d0fcf52501e36d436f"];
arr = arr.toString().replaceAll('"',"").trim();