# Parsing JSON with multiple values

**URL:** <https://community.glideapps.com/t/parsing-json-with-multiple-values/64225>\
**Category:** Ask for Help\
**Created:** [July 21, 2023, 3:10pm UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225 "2023-07-21T15:10:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcmaad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jcmaad](https://community.glideapps.com/u/jcmaad)\
**Post date:** [July 21, 2023, 3:10pm UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225/1 "2023-07-21T15:10:01Z")

</div>

Hi,

I have the following JSON data that I would to transform into the following data:

> [{“id”:16,“name”:“Animation”},{“id”:10751,“name”:“Family”}]

into

> Animation, Family.

Parsing methods I found online only show Animation.

---

<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:** [July 21, 2023, 3:26pm UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225/2 "2023-07-21T15:26:33Z")

</div>

Your JSON contains a collection, so you need to extract it across multiple rows.  
Add enough rows to cover the maximum number of items, number the rows beginning at zero, and use the following JavaScript:

```auto
const json = JSON.parse(p1);
return json[p2].name;

```

 ![CleanShot 2023-07-21 at 23.25.24@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/0/d08bfb72cc9b43b58f75babb3f563f81838336e4.png)

 ![CleanShot 2023-07-21 at 23.25.53@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/1/c1b8b5e23eeaa8bb5dc7747f547a14cf43696adb.png)

---

<div class="post-metadata">

**Author:** ![jcmaad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jcmaad](https://community.glideapps.com/u/jcmaad)\
**Post date:** [July 21, 2023, 3:39pm UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225/3 "2023-07-21T15:39:45Z")

</div>

Thank you, but that’s not exactly what I am looking for.  
Each row has its own JSON data, so I was looking to have “Animation, Family” in a single cell.

I found this solution, but I am not able to pass p1 as a value:

> var data = p1  
> var result = data.map(function(val) {  
> return val.name;  
> }).join(', ');
> 
> return (result)

---

<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:** [July 21, 2023, 3:43pm UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225/4 "2023-07-21T15:43:13Z")

</div>

Okay, if you want a comma separated list on a single line, then here is a version of your code that will work:

```auto
const json = JSON.parse(p1);
const result = json.map(function(val) {
  return val.name;
}).join(', ');

return result;

```

 ![CleanShot 2023-07-21 at 23.42.43@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/e/ae60396f6ab3b4df419ea3713781f5b176e84c9e.png)

---

<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:** [July 22, 2023, 2:19am UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225/5 "2023-07-22T02:19:27Z")

</div>

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

Here’s my alternative using the new Query JSON column.

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

```

---

<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:** [July 23, 2023, 2:20am UTC](https://community.glideapps.com/t/parsing-json-with-multiple-values/64225/6 "2023-07-23T02:20:01Z")

</div>

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