Hi Guys,
I have a JSON
"great",
"check",
"good",
"amazing",
"visit",
"cbd",
"nice",
"wow",
"star_boss__prasad",
"poojarao108",
"ambrishthakurthakur",
"clinic",
"hemp",
"seeds",
"awesome",
"products",
"shalabhrao",
"woww",
"gonna",
"bro",
"sir",
"weight",
"plz",
"delhi",
"kaise",
"saans",
"rehe",
"ho?",
"niranjanvnaik",
"boon",
"experience",
"superb",
"recommendation",
"wow!",
"checking",
"jiasingh",
"glad",
"hear",
"this!",
"voiceover",
"videos",
"beautiful",
"incredibly",
"informative",
"noticeable",
"improvement",
"super",
"loadingmiles",
"couldn’t",
"agree",
"more!",
"grow",
"wiser",
"understand",
"holistic",
"wellness",
"located",
"bangalore",
"adityamendonca",
"ooo",
"love",
"adding",
"topping",
"oats!",
"hear!",
"yogacaro",
"favourite",
"danesmedical",
"it’s",
"benefits",
"highlighted",
"mainstream",
"i’ve",
"fantastic",
"grubmode",
"host",
"interesting",
"place",
"disharajputx",
"consult",
"doctor?",
"wonderful",
"ma’am",
"nyc",
"video",
"city",
"india",
"uuk",
"worst",
"hyderabad",
"soo",
"surely",
"woww!!!!",
"sounds",
"worth",
"loved",
"fabulous",
"content",
"post",
"_fashionnfuel_"
]```
I am trying to clean it up by using JS so that I can get all these word separated by ","
I am using this JS
let inputArray;
try {
inputArray = JSON.parse(p1 || ‘’); // Parse p1 as JSON
} catch (e) {
return ‘Invalid JSON input’; // Handle invalid JSON
}
const cleanedArray = inputArray
.map(item => item.trim().replace(/[^a-zA-Z0-9]/g, ‘’)) // Remove special characters
.filter(item => item !== ‘’); // Remove empty strings
return cleanedArray.join(‘,’);
I am not getting anything, I understand that p1 which is m JSON is not accepted input.
Can you guys help me how can I solve this issue?
Thank you in advance for helping me.
Regards,
Dilip