# Need Help with Javascript:

**URL:** https://community.glideapps.com/t/need-help-with-javascript/79077
**Category:** Ask for Help
**Created:** [January 9, 2025, 7:13am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077 "2025-01-09T07:13:49Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Dilip\_Adiga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilip_adiga/32/60330_2.png) [@Dilip\_Adiga](https://community.glideapps.com/u/Dilip_Adiga)
#### Post date: [January 9, 2025, 7:13am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/1 "2025-01-09T07:13:49Z")

</div>

Hi Guys,

I have a JSON

````auto
  "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(‘,’);

```auto

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
```

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 9, 2025, 2:17pm UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/2 "2025-01-09T14:17:15Z")

</div>

You don’t need JavaScript. Instead use a Query JSON column.

 ![CleanShot 2025-01-09 at 22.16.15@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/c/ac3b89563da8857d57840754af8b4e28049b2a82.png)

```auto
$join($,",")

```

---

<div class="post-metadata">

### Author: ![Dilip\_Adiga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilip_adiga/32/60330_2.png) [@Dilip\_Adiga](https://community.glideapps.com/u/Dilip_Adiga)
#### Post date: [January 10, 2025, 3:53am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/3 "2025-01-10T03:53:36Z")

</div>

Hi @Darren_Murphy ,

Thank you it works amazingly well.

I had one more question.

Is there any such short cut to extract Value from a JSON object?

{  
“Bangalore”: 36.36,  
“Delhi”: 9.09,  
“Mumbai”: 9.09,  
“Dubai”: 9.09,  
“Hyderabad”: 9.09,  
“Others”: 36.36  
}

I need to extract values of this.

Is Javascript the only way?

Regards,  
Dilip

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 10, 2025, 5:03am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/4 "2025-01-10T05:03:19Z")

</div>

You can also use Query JSON, but I’m not clear what you want. What would you expect the result to be?

---

<div class="post-metadata">

### Author: ![Dilip\_Adiga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilip_adiga/32/60330_2.png) [@Dilip\_Adiga](https://community.glideapps.com/u/Dilip_Adiga)
#### Post date: [January 10, 2025, 5:24am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/5 "2025-01-10T05:24:28Z")

</div>

Hi @Darren_Murphy ,

Thank you for replying

EX:

{  
“2024-10-12”: {  
“reach”: 7899418  
},  
“2024-10-13”: {  
“reach”: 7899500  
},  
“2024-10-14”: {  
“reach”: 7899700  
}  
}

this will basically be accumulated over time. which I would need to plot the reach and dates on a graph

I would need the latest 5 dates which is Key and Latest 5 values corresponding to dates.

Let me know if you need more clarity.

Thank you again.

Regards,  
Dilip

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 10, 2025, 6:45am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/6 "2025-01-10T06:45:11Z")

</div>

> [@Dilip\_Adiga](#):
>
> {  
> “2024-10-12”: {  
> “reach”: 7899418  
> },  
> “2024-10-13”: {  
> “reach”: 7899500  
> },  
> “2024-10-14”: {  
> “reach”: 7899700  
> }  
> }

Given the above input, please show me your expected output.

---

<div class="post-metadata">

### Author: ![Dilip\_Adiga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilip_adiga/32/60330_2.png) [@Dilip\_Adiga](https://community.glideapps.com/u/Dilip_Adiga)
#### Post date: [January 10, 2025, 8:29am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/7 "2025-01-10T08:29:19Z")

</div>

Hi @Darren_Murphy ,

Thank you for replying.

I am sorry, I just put information out wrongly.

I am getting JSON array like this

```auto
[
  {
    "2025-01-08": {
      "reach": 1526178
    }
  },
  {
    "2025-01-09": {
      "reach": 1547229
    }
  },
  {
    "2025-01-10": {
      "reach": 1547465
    }
  }
]

```

I am to able to use JS to convert it.

I want one column to have my dates like this  
2024-10-12,2024-10-13,2024-10-14

Other column to have values like this

7899418, 7899500, 7899700

if there are more key or values all those values should come separated by comma

Regards,  
Dilip

---

<div class="post-metadata">

### Author: ![Andrew\_Davies](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrew_davies/32/41838_2.png) [@Andrew\_Davies](https://community.glideapps.com/u/Andrew_Davies)
#### Post date: [January 10, 2025, 10:54am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/8 "2025-01-10T10:54:45Z")

</div>

So do you mean you want to add this dynamically to a table? With one row per item and a column for date and reach?

If so - that can be achieved - just confirm that’s what you’re after and we will explain how!

---

<div class="post-metadata">

### Author: ![Dilip\_Adiga](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilip_adiga/32/60330_2.png) [@Dilip\_Adiga](https://community.glideapps.com/u/Dilip_Adiga)
#### Post date: [January 10, 2025, 11:36am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/9 "2025-01-10T11:36:31Z")

</div>

Hi @Andrew_Davies ,

thank you for responding.

No no I just want to add it to another column with comma separation.

Regards,  
Dilip

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [January 17, 2025, 11:37am UTC](https://community.glideapps.com/t/need-help-with-javascript/79077/10 "2025-01-17T11:37:22Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
