# Can't use $type in jsonata expression

**URL:** <https://discourse.nodered.org/t/cant-use-type-in-jsonata-expression/52560>\
**Category:** General\
**Created:** [22 October 2021 09:08 UTC](https://discourse.nodered.org/t/cant-use-type-in-jsonata-expression/52560 "2021-10-22T09:08:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jc-nr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jc-nr/32/49790_2.png) [@jc-nr](https://discourse.nodered.org/u/jc-nr)\
**Post date:** [22 October 2021 09:08 UTC](https://discourse.nodered.org/t/cant-use-type-in-jsonata-expression/52560/1 "2021-10-22T09:08:02Z")

</div>

Hello,

I'm trying to use the $type function ( [Object functions · JSONata](https://docs.jsonata.org/object-functions#type) ) in a jsonata expression.  
But it seems it's not recognized as a valid function.

```auto
Error evaluating expression:
  Attempted to invoke a non-function

```

How can I make it work ?  
I use it to normalize a json structure.

Best regards

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 October 2021 09:13 UTC](https://discourse.nodered.org/t/cant-use-type-in-jsonata-expression/52560/2 "2021-10-22T09:13:23Z")

</div>

Hi @jc-nr

What version of Node-RED are you using? I just configured a Change to to the expression `$type(payload)` and it worked.

Can you share your JSONata expression?

---

<div class="post-metadata">

**Author:** ![jc-nr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jc-nr/32/49790_2.png) [@jc-nr](https://discourse.nodered.org/u/jc-nr)\
**Post date:** [22 October 2021 09:58 UTC](https://discourse.nodered.org/t/cant-use-type-in-jsonata-expression/52560/3 "2021-10-22T09:58:32Z")

</div>

Damn, you're right. Using a Node-Red 0.20.3 here. Meaning, it calls Jsonata 1.6.4.  
I should have checked that in the first place.

Sorry for the inconvenience...

---

<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:** [21 December 2021 09:59 UTC](https://discourse.nodered.org/t/cant-use-type-in-jsonata-expression/52560/4 "2021-12-21T09:59:11Z")

</div>

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