# Error Error("json: unsupported value: NaN")

**URL:** <https://www.thethingsnetwork.org/forum/t/error-error-json-unsupported-value-nan/37284>\
**Category:** Application Development\
**Created:** [May 23, 2020, 12:00pm UTC](https://www.thethingsnetwork.org/forum/t/error-error-json-unsupported-value-nan/37284 "2020-05-23T12:00:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lora\_kronburg](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/lora_kronburg/32/35697_2.png) [@lora\_kronburg](https://www.thethingsnetwork.org/forum/u/lora_kronburg)\
**Post date:** [May 23, 2020, 12:00pm UTC](https://www.thethingsnetwork.org/forum/t/error-error-json-unsupported-value-nan/37284/1 "2020-05-23T12:00:34Z")

</div>

Hello,  
I want to compare values of bytes array to e.g. 0xF.

```
if (bytes[2] === 0xF)
    {
      values[0] = retValue.x1 - 65536;
    }

```

However I get this error: Error(“json: unsupported value: NaN”)  
I couldn’t find an existing topic to this problem with comparing values.

What is the problem?

Thanks  
Martin

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [May 23, 2020, 12:33pm UTC](https://www.thethingsnetwork.org/forum/t/error-error-json-unsupported-value-nan/37284/2 "2020-05-23T12:33:04Z")

</div>

The error is not in the lines you posted, but is thrown when TTN tries to convert the return value of your Decoder function into a JSON text representation. So, we’d need to see all code to guess what’s wrong.

(Aside: also note that `0xF` is really the same as `0x0F`; probably not the `if` condition [you really want](https://www.thethingsnetwork.org/forum/t/signed-short-decoder/37283/3).)
