# Query JSON Data

**URL:** <https://community.glideapps.com/t/query-json-data/64206>\
**Category:** Ask for Help\
**Created:** [July 21, 2023, 4:07am UTC](https://community.glideapps.com/t/query-json-data/64206 "2023-07-21T04:07:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [July 21, 2023, 4:07am UTC](https://community.glideapps.com/t/query-json-data/64206/1 "2023-07-21T04:07:11Z")

</div>

Testing out the JSON columns and have no real experience with JSON, but can’t seem to accomplish a (seemingly) simple task.  
A sample of my data looks like this:

```auto
[
{"itemNO": "A1234",
"status": "Available"},
{"itemNO": "B1234",
"status": "Available"},
{"itemNO": "C1234",
"status": "Sold"}
]

```

I want to retrieve the status of an item based on the item number. So for example, the status for "C1234. Using JSONata, the expression “itemNO” gets me an array of all item numbers, but I can’t seem to figure out how to just get one value based on the item number. Any guidance would be appreciated.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [July 22, 2023, 12:32am UTC](https://community.glideapps.com/t/query-json-data/64206/2 "2023-07-22T00:32:08Z")

</div>

Hola!

By “accident”, you have an object array with 3 items. 😉

Here we explained your case and another similar: [Create json from whole table - #3 by gvalero](https://community.glideapps.com/t/create-json-from-whole-table/62624/3)

To sum up, what you need is:

```auto
.[2]."status"

```

Saludos!

---

<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, 1:34am UTC](https://community.glideapps.com/t/query-json-data/64206/3 "2023-07-22T01:34:28Z")

</div>

> [@BLA\_68](#):
>
> So for example, the status for "C1234

`$[itemNO="C1234"].status`

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

Another test.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/6/96f53d17636c951252e3845a7a9fda317d5f2db7.png)

JSONata is awesome.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [July 22, 2023, 2:08am UTC](https://community.glideapps.com/t/query-json-data/64206/4 "2023-07-22T02:08:07Z")

</div>

> [@ThinhDinh](#):
>
> JSONata is awesome.

Ah, we are talking about the new Query JSON column… WTF!! 🤣

I still try to understand the main advantages, but in the meantime this syntax works too:

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/03b4b1b73dadd89f7f6a3d372711c386a9d87bd2.png)

```auto
$[2].status

```

In addition,

```auto
$[].status ==> $[itemNO].status

```

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/5/c52b358ebeb91b0d4d25b1749347523398a1c173.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:22am UTC](https://community.glideapps.com/t/query-json-data/64206/5 "2023-07-22T02:22:51Z")

</div>

For more reference:

`$[2].status` returns the status of the 3rd element in the array (index 2).

`$[itemNO].status` returns an array format of all status. But you can use a join function to get a comma-delimited list instead, which might be easier down the line for further transformation.

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

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [July 22, 2023, 3:51am UTC](https://community.glideapps.com/t/query-json-data/64206/6 "2023-07-22T03:51:56Z")

</div>

This is so great! Works perfectly.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [July 22, 2023, 2:18pm UTC](https://community.glideapps.com/t/query-json-data/64206/7 "2023-07-22T14:18:04Z")

</div>

> [@ThinhDinh](#):
>
> ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/3/c3ac51f569f7120b31dd5b20485003673ec34f81.png)

Super cool, we can create crazy things like this:

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

Shouldn’t this plugin be called **Query JSONata** or have some “_JSONata_” reference to make it different from the current Transform JSON plugin? 🥴

Gracias Thinh!

---

<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, 11:54pm UTC](https://community.glideapps.com/t/query-json-data/64206/8 "2023-07-22T23:54:54Z")

</div>

Yeah, I would love if we can get a JSONata reference in there 😉

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [July 23, 2023, 6:11pm UTC](https://community.glideapps.com/t/query-json-data/64206/9 "2023-07-23T18:11:14Z")

</div>

Playing around with this a little more, it’s a disappointing limitation that the JSON source cannot be a URL. Or am I missing something. I know the existing Fetch JSON column that uses JQ can, but not, seemingly, this newer JSON column(s).

---

<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 23, 2023, 11:26pm UTC](https://community.glideapps.com/t/query-json-data/64206/10 "2023-07-23T23:26:44Z")

</div>

Yeah currently it’s set up like that. I use the alpha version API call column (limited access) in tandem with this.
