# Error handling in json.parse

**URL:** <https://community.influxdata.com/t/error-handling-in-json-parse/23554>\
**Category:** Fluxlang\
**Tags:** flux, json\
**Created:** [January 26, 2022, 6:25pm UTC](https://community.influxdata.com/t/error-handling-in-json-parse/23554 "2022-01-26T18:25:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qm3ster](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/qm3ster/32/4593_2.png) [@qm3ster](https://community.influxdata.com/u/qm3ster)\
**Post date:** [January 26, 2022, 6:25pm UTC](https://community.influxdata.com/t/error-handling-in-json-parse/23554/1 "2022-01-26T18:25:31Z")

</div>

```auto
import "array"
import "experimental/json"
import "experimental"

array.from(rows: [{_time: experimental.subDuration(from: now(), d: 30m), _value: "69"}, {_time: now(), _value: "1"}])
    |> map(fn: (r) => ({r with _value: json.parse(data: bytes(v: r._value))}))

```

Now, if some of the JSON was not JSON at all, but garbage, I wouldn’t even be able to use `exists` hacks to filter it out.

Are there any plans to implement error handling so that I can filter off things like that while retaining the healthy rows in my query?

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [January 28, 2022, 11:00am UTC](https://community.influxdata.com/t/error-handling-in-json-parse/23554/2 "2022-01-28T11:00:00Z")

</div>

Hi @qm3ster,  
I have passed this on to the product management board for comment. So sadly I don’t believe there is an out the box solution at the moment. Currently, you could do some clever conditional arguments which check the characteristics of your input before parsing the json.

---

<div class="post-metadata">

**Author:** ![qm3ster](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/qm3ster/32/4593_2.png) [@qm3ster](https://community.influxdata.com/u/qm3ster)\
**Post date:** [January 30, 2022, 3:31pm UTC](https://community.influxdata.com/t/error-handling-in-json-parse/23554/3 "2022-01-30T15:31:46Z")

</div>

I believe the language _will_ need some kind of error handling in the long run, be that via a `Result` type or some kind of catching exceptions, but I see it isn’t possible right now.  
Anyway, my data massaging is somewhat beyond the reach of Flux and even Telegraf at the moment, so I will continue to run my own executables.
