# Javascript : Json traversing list

**URL:** <https://community.glideapps.com/t/javascript-json-traversing-list/38543>\
**Category:** Ask for Help\
**Created:** [February 16, 2022, 1:34am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543 "2022-02-16T01:34:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttv\_neezy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ttv_neezy/32/39040_2.png) [@ttv\_neezy](https://community.glideapps.com/u/ttv_neezy)\
**Post date:** [February 16, 2022, 1:34am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/1 "2022-02-16T01:34:41Z")

</div>

Hello, I wan’t to return minimal object[price] on all these object list, I use javascript but I think list indexing is bugged

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/d/edd36740af61b3644fceb295a3fdc911826bda87.png)

the api used is : [https://api.gtaliferp.fr:8443/v1/extinction/marketplace/sell/weapon\_assaultrifle](https://api.gtaliferp.fr:8443/v1/extinction/marketplace/sell/weapon_assaultrifle)

thank for the help.

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [February 16, 2022, 1:39am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/2 "2022-02-16T01:39:15Z")

</div>

`items` is a string value, not an array. You should use `JSON.parse(p1)` to get `data`, but better yet, use the Transform JSON plugin:

> **[Transform JSON column • Glide](https://www.glideapps.com/plugins/jq)**
>
> Transform JSON with JQ

---

<div class="post-metadata">

**Author:** ![ttv\_neezy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ttv_neezy/32/39040_2.png) [@ttv\_neezy](https://community.glideapps.com/u/ttv_neezy)\
**Post date:** [February 16, 2022, 1:46am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/3 "2022-02-16T01:46:14Z")

</div>

> [@david](#):
>
> JSON.parse(p1)

hey, thank for your response but i tried the 2 options and no one works

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/d/bdd7e62f27784444ca0c7916b2ff3baea74e5fef.png)

have you another idea ?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 16, 2022, 3:48am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/4 "2022-02-16T03:48:58Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/4/141973a226e5d1bc55fc383b756e2af17b3cbb1e.png)

You can use this jq query in the original column if what you want is just the 1st id.

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [February 16, 2022, 3:59am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/5 "2022-02-16T03:59:21Z")

</div>

@ttv_neezy

```nohighlight
const data = JSON.parse(p1);
return data[0];

```

---

<div class="post-metadata">

**Author:** ![ttv\_neezy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ttv_neezy/32/39040_2.png) [@ttv\_neezy](https://community.glideapps.com/u/ttv_neezy)\
**Post date:** [February 16, 2022, 9:28am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/6 "2022-02-16T09:28:46Z")

</div>

to explain I search to compare all “price” in this api so I think I need to use javascript

---

<div class="post-metadata">

**Author:** ![ttv\_neezy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ttv_neezy/32/39040_2.png) [@ttv\_neezy](https://community.glideapps.com/u/ttv_neezy)\
**Post date:** [February 16, 2022, 9:29am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/7 "2022-02-16T09:29:54Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/f/dff541a51fb01a4d45fe297f6e0fc7e7a8463fd3.png)

thank for your response but same when i just want to get data, it returns nothing

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 16, 2022, 9:44am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/8 "2022-02-16T09:44:05Z")

</div>

Ah that’s true. Yeah I think Javascript is needed.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 16, 2022, 9:59am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/9 "2022-02-16T09:59:50Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/d/4de93c561e4832bf93f0e5842164da01784b826f.png)

Here you go. First I returned a list of prices from the API.

Then use JavaScript to get the minimum from the array.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/e/8e09031db51b034d70f5e4a6404a0afe492f4454.png)

```auto
const arr = p1.replace("[","").replace("]","").split(",");
const min = Math.min(...arr)
return min;

```

---

<div class="post-metadata">

**Author:** ![ttv\_neezy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ttv_neezy/32/39040_2.png) [@ttv\_neezy](https://community.glideapps.com/u/ttv_neezy)\
**Post date:** [February 16, 2022, 10:41am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/10 "2022-02-16T10:41:06Z")

</div>

Is a way to send a notification with these data ?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 16, 2022, 11:54am UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/11 "2022-02-16T11:54:15Z")

</div>

If you’re talking about native notifications then no.

If it’s not native notification then please elaborate on what type of notification you want people to receive.

---

<div class="post-metadata">

**Author:** ![ttv\_neezy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ttv_neezy/32/39040_2.png) [@ttv\_neezy](https://community.glideapps.com/u/ttv_neezy)\
**Post date:** [February 16, 2022, 12:01pm UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/12 "2022-02-16T12:01:45Z")

</div>

> [@ThinhDinh](#):
>
> f it’s not native notification then please elaborate on wh

yes i was talking about native notification so thank you for your help and have a good day

---

<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:** [February 17, 2022, 12:02pm UTC](https://community.glideapps.com/t/javascript-json-traversing-list/38543/13 "2022-02-17T12:02:33Z")

</div>

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