# Searching for array entries in jsonata

**URL:** <https://discourse.nodered.org/t/searching-for-array-entries-in-jsonata/45878>\
**Category:** General\
**Created:** [18 May 2021 19:48 UTC](https://discourse.nodered.org/t/searching-for-array-entries-in-jsonata/45878 "2021-05-18T19:48:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![crackytsi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crackytsi/32/28369_2.png) [@crackytsi](https://discourse.nodered.org/u/crackytsi)\
**Post date:** [18 May 2021 19:48 UTC](https://discourse.nodered.org/t/searching-for-array-entries-in-jsonata/45878/1 "2021-05-18T19:48:38Z")

</div>

Hi,  
I have a JSON of the structure:

```auto
{
	"data": [
		{
			"id": "1232",
			"tags": [
				"tagA",
				"test",
				"tagB"
			], "more": true
		},
		{
			"id": "2232",
			"tags": [
				"tagD",
				"test",
				"tagB"
			], "more": true
		},
		{
			"id": "3432",
			"tags": [
				"tagA",
				"test",
				"tagG"
			], "more": true
		}		
	]
}

```

Now I try to get the entry in data that has a specific entry in tags, e.g. tagG.  
Expected Output:

```auto
		{
			"id": "3432",
			"tags": [
				"tagA",
				"test",
				"tagG"
			],
              "more": true
		}

```

Unfortunately all my tries to query this in jsonata fail.  
all tries e.g. like data[tags="tagG"] or using $contains bring always no or all results.

Can you help me or is this not possible with JSONATA?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 May 2021 20:43 UTC](https://discourse.nodered.org/t/searching-for-array-entries-in-jsonata/45878/2 "2021-05-18T20:43:35Z")

</div>

~~Try~~  
~~payload.data[id="3432"]  
Presuming the object is in msg.payload.~~  
strike that miss read the question will be back in a mo

[edit try  
`payload.data["tagG" in tags]`

> **[Comparison Operators · JSONata](https://docs.jsonata.org/comparison-operators#in-inclusion)**
>
> \## \`=\` (Equals)

]

---

<div class="post-metadata">

**Author:** ![crackytsi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crackytsi/32/28369_2.png) [@crackytsi](https://discourse.nodered.org/u/crackytsi)\
**Post date:** [19 May 2021 07:16 UTC](https://discourse.nodered.org/t/searching-for-array-entries-in-jsonata/45878/3 "2021-05-19T07:16:24Z")

</div>

Thanks, I can't understand why I did not find this solution on my own 😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 June 2021 07:17 UTC](https://discourse.nodered.org/t/searching-for-array-entries-in-jsonata/45878/4 "2021-06-02T07:17:18Z")

</div>

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