# .jsonDecode Filter

**URL:** <https://forum.inductiveautomation.com/t/jsondecode-filter/15061>\
**Category:** Ignition\
**Created:** [August 14, 2017, 10:28pm UTC](https://forum.inductiveautomation.com/t/jsondecode-filter/15061 "2017-08-14T22:28:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrodrigues](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@rrodrigues](https://forum.inductiveautomation.com/u/rrodrigues)\
**Post date:** [August 14, 2017, 10:28pm UTC](https://forum.inductiveautomation.com/t/jsondecode-filter/15061/1 "2017-08-14T22:28:57Z")

</div>

Any idea how to filter dictionaries? I am using the function system.net.httpGet to get a JSON string then converting it into a dictionary using system.util.jsonDecode(). I get the following results:

[…]  
[{u’value’: 3.6377865516, u’timestamp’: 1498867200, u’realDate’: ‘2017-07-01 12:00:00’},  
{u’value’: None, u’timestamp’: 1498868100}, {u’value’: None, u’timestamp’: 1498869000},  
{u’value’: None, u’timestamp’: 1498869900}, {u’value’: None, u’timestamp’: 1498870800},  
{u’value’: None, u’timestamp’: 1498871700}, {u’value’: None, u’timestamp’: 1498872600},  
[…]

I need to work with this data later on, so I was wondering how I can filter it and get only the values that are different than None. Pretty much the first row.

I am pretty new to ignition and Python, so I apologize in advance for my lack of knowledge.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 14, 2017, 10:43pm UTC](https://forum.inductiveautomation.com/t/jsondecode-filter/15061/2 "2017-08-14T22:43:17Z")

</div>

Python has a built-in `filter` function, that you could use like this:

```python
original = system.util.jsonDecode(...)
filtered = filter(lambda x: x['value'] is not None, original)

```

This should leave you with a list of only dictionaries that had a ‘value’ key defined.

[https://docs.python.org/2/library/functions.html#filter](https://docs.python.org/2/library/functions.html#filter)

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [August 17, 2017, 6:46pm UTC](https://forum.inductiveautomation.com/t/jsondecode-filter/15061/4 "2017-08-17T18:46:13Z")

</div>

> [@Kevin.Herron](#):
>
> original = system.util.jsonDecode(...)  
> filtered = filter(lambda x: x['value'] is not None, original)

You could also try:

```auto
original = system.util.jsonDecode(...)
filtered = [x for x in original if x['value'] is not None]

```
