# Json array filtering

**URL:** <https://discourse.nodered.org/t/json-array-filtering/21127>\
**Category:** General\
**Created:** [1 February 2020 09:15 UTC](https://discourse.nodered.org/t/json-array-filtering/21127 "2020-02-01T09:15:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![redlop](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@redlop](https://discourse.nodered.org/u/redlop)\
**Post date:** [1 February 2020 09:15 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/1 "2020-02-01T09:15:35Z")

</div>

Is there a way to filter a Json array that contains the scanned wifi networks on an area based on their ssid? Because right now every network in the area displays on the ui. I only need the networks with the specific characters.

For example, the area contains 10 networks and i only need the networks with ssids containing "ESP\_\*\*\*" the \*\*\* can be any 3-digit combination.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/4243ed7b338b796a4a8c190b4ca4950b41de2ccb.png)

this is what my flow looks like.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 February 2020 10:04 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/2 "2020-02-01T10:04:09Z")

</div>

Use a debug to show the structure of the data you want to filter and post it here so we can see exactly what you have. Note that a JSON object is, by definition, a string. Perhaps you mean a javascript object containing an array. Also tell us exactly what you want to see in the filtered output.

---

<div class="post-metadata">

**Author:** ![redlop](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@redlop](https://discourse.nodered.org/u/redlop)\
**Post date:** [1 February 2020 10:12 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/3 "2020-02-01T10:12:14Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f7eb6c51414a822db03fa0c18118ef2d7e6c6c7e.png)

I only want to show the network with the ssid that has "ESP\_\*\*\*" with it.

edit:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4fde34fda21456140b4d9accb092063c49acf865.png)  
this is how it looks like on the ui

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [1 February 2020 10:29 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/4 "2020-02-01T10:29:14Z")

</div>

With function node probably like this

```auto
msg.payload = msg.payload.Networks.filter(el => el.SSID.includes("ESP_"))
return msg

```

---

<div class="post-metadata">

**Author:** ![redlop](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@redlop](https://discourse.nodered.org/u/redlop)\
**Post date:** [1 February 2020 10:38 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/5 "2020-02-01T10:38:23Z")

</div>

It works when I connect it to a debug node. But I need it to display on the ui, what do I need to change in this template node?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c9652ab0bac6ebcf356cb731be33dc48c7bedc3.png)

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [1 February 2020 10:40 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/6 "2020-02-01T10:40:05Z")

</div>

change the ng-repeat to `"x in msg.payload"`

---

<div class="post-metadata">

**Author:** ![redlop](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@redlop](https://discourse.nodered.org/u/redlop)\
**Post date:** [1 February 2020 10:43 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/7 "2020-02-01T10:43:13Z")

</div>

It is now working. Thank you!

---

<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:** [1 April 2020 10:43 UTC](https://discourse.nodered.org/t/json-array-filtering/21127/8 "2020-04-01T10:43:18Z")

</div>

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