# \#jsonata

**URL:** https://discourse.nodered.org/tag/jsonata/68.md

[Latest](https://discourse.nodered.org/latest.md) · [Categories](https://discourse.nodered.org/categories.md) · [Tags](https://discourse.nodered.org/tags.md)

---

## [JSONata $base64decode does not support UTF8 strings](https://discourse.nodered.org/t/jsonata-base64decode-does-not-support-utf8-strings/101146)

<div class="topic-metadata">

**Author:** [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Replies:** 3\
**Last updated:** [28 May 2026 15:34 UTC](https://discourse.nodered.org/t/jsonata-base64decode-does-not-support-utf8-strings/101146 "2026-05-28T15:34:52Z")

</div>

Hi There, Taking this string Teiüäösß utf8 fïléñámê.m4a, encode as base64\[1\]: echo "Teiüäösß utf8 fïléñámê.m4a" | base64 and get this string VGVpdcyIYcyIb8yIc8OfIHV0ZjggZmnMiGxlzIFuzINhzIFtZcyCLm00YQo= I…

---

## [JSONata $toMillis() in change node will not convert an ISO complaint date string](https://discourse.nodered.org/t/jsonata-tomillis-in-change-node-will-not-convert-an-iso-complaint-date-string/101003)

<div class="topic-metadata">

**Author:** [@IanH](https://discourse.nodered.org/u/IanH)\
**Replies:** 10\
**Last updated:** [16 May 2026 11:10 UTC](https://discourse.nodered.org/t/jsonata-tomillis-in-change-node-will-not-convert-an-iso-complaint-date-string/101003 "2026-05-16T11:10:19Z")

</div>

I have another anomaly when using JSONata in a change node, and it is to do with time/date objects (of course). I am using a node-red-contrib-sun-event-trigger to produce a sunrise trigger, and also capture the days oth…

---

## [$split doesn't support default settings?](https://discourse.nodered.org/t/split-doesnt-support-default-settings/101002)

<div class="topic-metadata">

**Author:** [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Replies:** 4\
**Last updated:** [13 May 2026 16:10 UTC](https://discourse.nodered.org/t/split-doesnt-support-default-settings/101002 "2026-05-13T16:10:21Z")

</div>

Hi There, This might be a known unknown since I'm using NR 4.0.9 - so it might be fixed already. Or maybe it's not a bug? In which case what am I doing wrong! It concerns JSONata $split: The description gives me t…

---

## [Extending JSONata with my own functions](https://discourse.nodered.org/t/extending-jsonata-with-my-own-functions/99873)

<div class="topic-metadata">

**Author:** [@dubnemo](https://discourse.nodered.org/u/dubnemo)\
**Replies:** 2\
**Last updated:** [5 December 2025 20:39 UTC](https://discourse.nodered.org/t/extending-jsonata-with-my-own-functions/99873 "2025-12-05T20:39:43Z")

</div>

Is there a way in Node-RED to register my own functions so they can be accessed within a JSONata transformation? Other tools like Mulesoft allow you to extend DataWeave by add a jar file containing public Java methods, …

---

## [Cannot test context functions $flowContext or $globalContext](https://discourse.nodered.org/t/cannot-test-context-functions-flowcontext-or-globalcontext/99872)

<div class="topic-metadata">

**Author:** [@dubnemo](https://discourse.nodered.org/u/dubnemo)\
**Replies:** 2\
**Last updated:** [5 December 2025 17:03 UTC](https://discourse.nodered.org/t/cannot-test-context-functions-flowcontext-or-globalcontext/99872 "2025-12-05T17:03:34Z")

</div>

Is this just a warning since the values are not accessible from the Test tab in the JSONata editor?

---

## [JSONata exception -- JSONata expression help please](https://discourse.nodered.org/t/jsonata-exception-jsonata-expression-help-please/99658)

<div class="topic-metadata">

**Author:** [@dubnemo](https://discourse.nodered.org/u/dubnemo)\
**Replies:** 16\
**Last updated:** [19 November 2025 14:39 UTC](https://discourse.nodered.org/t/jsonata-exception-jsonata-expression-help-please/99658 "2025-11-19T14:39:29Z")

</div>

I am at a loss why this JSONata is failing with the following error:' Expected "}", got ":" I am trying to prepare the JSON payload for a QuickBase API call: This is not how I would have shaped this JSON but it is th…

---

## [Inject: inconsistent JSONata error message](https://discourse.nodered.org/t/inject-inconsistent-jsonata-error-message/99050)

<div class="topic-metadata">

**Author:** [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Replies:** 9\
**Last updated:** [16 September 2025 09:43 UTC](https://discourse.nodered.org/t/inject-inconsistent-jsonata-error-message/99050 "2025-09-16T09:43:46Z")

</div>

Hi There, I'm just playing around with a broken JSONata expression: $match($$.payload, /./,-1) - the error here is "Invalid JSONata expression: Argument 1 of function "match" does not match function signature" That is …

---

## [Bug in JSONata inputs or just me?](https://discourse.nodered.org/t/bug-in-jsonata-inputs-or-just-me/98914)

<div class="topic-metadata">

**Author:** [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Replies:** 3\
**Last updated:** [2 September 2025 14:52 UTC](https://discourse.nodered.org/t/bug-in-jsonata-inputs-or-just-me/98914 "2025-09-02T14:52:16Z")

</div>

I think this JSONata input should be outlined in red and should make the node invalid. Because the properties are not enclosed in double-quotes as they should be for valid JSON. Am I right or not?

---

## [Use env or global variables in expression in change node](https://discourse.nodered.org/t/use-env-or-global-variables-in-expression-in-change-node/98856)

<div class="topic-metadata">

**Author:** [@grawsom](https://discourse.nodered.org/u/grawsom)\
**Replies:** 10\
**Last updated:** [28 August 2025 09:41 UTC](https://discourse.nodered.org/t/use-env-or-global-variables-in-expression-in-change-node/98856 "2025-08-28T09:41:23Z")

</div>

Found an old post by @E1cid where DB1 button was configured to change info on every press (toggle). I have changed that to DB2 and is working fine, my question now is. In DB2 you use msg.ui\_update.label to set the n…

---

## [Trouble with data preparation for ui-chart in template node](https://discourse.nodered.org/t/trouble-with-data-preparation-for-ui-chart-in-template-node/98219)

<div class="topic-metadata">

**Author:** [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Replies:** 2\
**Last updated:** [20 July 2025 12:00 UTC](https://discourse.nodered.org/t/trouble-with-data-preparation-for-ui-chart-in-template-node/98219 "2025-07-20T12:00:22Z")

</div>

\[{"id":"58e784fbf7b146f2","type":"change","z":"9cd9fa2d0d2e7202","name":"Option-4","rules":\[{"t":"set","p":"payload","pt":"msg","to":"\[{\\"nick\\":\\"MSP1\\",\\"mc\\":\\"m01\\",\\"Machine\\":\\"MACHINE-1\\",\\"Downtime\\":17,\\"rdate\\"…

---

## [JSONata use sequence index](https://discourse.nodered.org/t/jsonata-use-sequence-index/98141)

<div class="topic-metadata">

**Author:** [@L4RS](https://discourse.nodered.org/u/L4RS)\
**Replies:** 2\
**Last updated:** [15 July 2025 07:22 UTC](https://discourse.nodered.org/t/jsonata-use-sequence-index/98141 "2025-07-15T07:22:37Z")

</div>

Hello everbody, i have a number messages which are the result of a split node. I want to use the parts.index property of this messages to set the message topics. I try to do it by a change node with the follwing JSONata…

---

## [Trying to use JSONata $map for Nested arrays, getting Invalid JSONata expression: Expected "{", got "\["](https://discourse.nodered.org/t/trying-to-use-jsonata-map-for-nested-arrays-getting-invalid-jsonata-expression-expected-got/97190)

<div class="topic-metadata">

**Author:** [@dubnemo](https://discourse.nodered.org/u/dubnemo)\
**Replies:** 11\
**Last updated:** [23 May 2025 05:53 UTC](https://discourse.nodered.org/t/trying-to-use-jsonata-map-for-nested-arrays-getting-invalid-jsonata-expression-expected-got/97190 "2025-05-23T05:53:14Z")

</div>

This is barking in my change node using JSONata: \[ $map( payload, function($v) \[ { "fieldKey": "fieldUUID", "value": $v.fieldUUID }, …

---

## [$filter array is return undefined in logs - flow.fileContents or payload.arrayEntry not accessible?](https://discourse.nodered.org/t/filter-array-is-return-undefined-in-logs-flow-filecontents-or-payload-arrayentry-not-accessible/97170)

<div class="topic-metadata">

**Author:** [@dubnemo](https://discourse.nodered.org/u/dubnemo)\
**Replies:** 13\
**Last updated:** [21 May 2025 16:58 UTC](https://discourse.nodered.org/t/filter-array-is-return-undefined-in-logs-flow-filecontents-or-payload-arrayentry-not-accessible/97170 "2025-05-21T16:58:01Z")

</div>

I am trying $filter a subset of json based an email address in the JSON payload which I copied to flow.fileContents context data (attached), trying many variations of the function syntax. I get a $distinct list of email…

---

## [JSONata evaluate expression inside function node is returning empty object at debug window](https://discourse.nodered.org/t/jsonata-evaluate-expression-inside-function-node-is-returning-empty-object-at-debug-window/95834)

<div class="topic-metadata">

**Author:** [@shubhamnodered](https://discourse.nodered.org/u/shubhamnodered)\
**Replies:** 20\
**Last updated:** [8 March 2025 09:07 UTC](https://discourse.nodered.org/t/jsonata-evaluate-expression-inside-function-node-is-returning-empty-object-at-debug-window/95834 "2025-03-08T09:07:08Z")

</div>

Hi, I can work with JSONATA expression with inject node and change node fine but I'm facing an issue while working with JSONata inside the Function node. When I use JSONATA's .evaluate() method, i get empty object at t…

---

## [JSONata interprets message differently from debug node](https://discourse.nodered.org/t/jsonata-interprets-message-differently-from-debug-node/95750)

<div class="topic-metadata">

**Author:** [@IanH](https://discourse.nodered.org/u/IanH)\
**Replies:** 14\
**Last updated:** [4 March 2025 11:23 UTC](https://discourse.nodered.org/t/jsonata-interprets-message-differently-from-debug-node/95750 "2025-03-04T11:23:10Z")

</div>

SYSTEM Raspi 3B+ running recently updated bookworm NR 4.0.9 nodejs 20.18.3 Problem I have a case where JSONata in a change node is producing (to an element of an object) a different value to that displayed in a debu…

---

## [How to get Startdate and end date of a month for a given date](https://discourse.nodered.org/t/how-to-get-startdate-and-end-date-of-a-month-for-a-given-date/95457)

<div class="topic-metadata">

**Author:** [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Replies:** 2\
**Last updated:** [17 February 2025 11:07 UTC](https://discourse.nodered.org/t/how-to-get-startdate-and-end-date-of-a-month-for-a-given-date/95457 "2025-02-17T11:07:17Z")

</div>

I need to get starting day of the month and ending day of the month for a given date. how do i write a simple function for the same. I tried from this link, but i am unable to get the start day. \`Calculate Last Date of…

---

## [Arrays/Objects/Conversion](https://discourse.nodered.org/t/arrays-objects-conversion/94532)

<div class="topic-metadata">

**Author:** [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Replies:** 18\
**Last updated:** [13 January 2025 01:26 UTC](https://discourse.nodered.org/t/arrays-objects-conversion/94532 "2025-01-13T01:26:43Z")

</div>

I am very poor at explaining anything around arrays/objects. I have a function node before a pdfmake , which is working perfectly. now the input to my function node has changed due to cleaning up and simplifying my mys…

---

## [Jsonata, modify some elements in an array of objects](https://discourse.nodered.org/t/jsonata-modify-some-elements-in-an-array-of-objects/87216)

<div class="topic-metadata">

**Author:** [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Replies:** 13\
**Last updated:** [14 April 2024 16:25 UTC](https://discourse.nodered.org/t/jsonata-modify-some-elements-in-an-array-of-objects/87216 "2024-04-14T16:25:22Z")

</div>

Speaking of the names of debug nodes, @Colin recently said And I too have "debug 2514" etc So I thought "yes a simple flow to rename them ..." I can get a subset of flows.json, the offending nodes, using Jsonata in a…

---

## [Can I increment a (possibly null) context variable in a change node?](https://discourse.nodered.org/t/can-i-increment-a-possibly-null-context-variable-in-a-change-node/87041)

<div class="topic-metadata">

**Author:** [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Replies:** 8\
**Last updated:** [7 April 2024 00:57 UTC](https://discourse.nodered.org/t/can-i-increment-a-possibly-null-context-variable-in-a-change-node/87041 "2024-04-07T00:57:29Z")

</div>

I am trying to count the number of each node type in flows.json. Not difficult using a function but I would like to do it without writing javascript code. So read the file and split the resulting array gives me one mess…

---

## [Using variable to access Array](https://discourse.nodered.org/t/using-variable-to-access-array/86971)

<div class="topic-metadata">

**Author:** [@zachMtech](https://discourse.nodered.org/u/zachMtech)\
**Replies:** 5\
**Last updated:** [3 April 2024 15:54 UTC](https://discourse.nodered.org/t/using-variable-to-access-array/86971 "2024-04-03T15:54:12Z")

</div>

I'm working with Node-RED and using JSONata for expression handling. In my setup, I have an array named SMT where each element contains a node named item . Additionally, I have a variable named count that I intend to use…

---

## [JSON: how to generate random number?](https://discourse.nodered.org/t/json-how-to-generate-random-number/86554)

<div class="topic-metadata">

**Author:** [@realtebo](https://discourse.nodered.org/u/realtebo)\
**Replies:** 2\
**Last updated:** [19 March 2024 09:22 UTC](https://discourse.nodered.org/t/json-how-to-generate-random-number/86554 "2024-03-19T09:22:03Z")

</div>

I need to inject random a single value in a json. I am trying msg.payload = { "temperature" : jsonata("Math.random() \* 20 + 10").evaluate(), } msg.topic = "device/ht"; return msg; but temperature is empty. What i…

---

## [JSONata falls back to compatibility mode when there's a string ' msg ' in it](https://discourse.nodered.org/t/jsonata-falls-back-to-compatibility-mode-when-theres-a-string-msg-in-it/84692)

<div class="topic-metadata">

**Author:** [@RvG](https://discourse.nodered.org/u/RvG)\
**Replies:** 4\
**Last updated:** [19 January 2024 09:48 UTC](https://discourse.nodered.org/t/jsonata-falls-back-to-compatibility-mode-when-theres-a-string-msg-in-it/84692 "2024-01-19T09:48:03Z")

</div>

JSONata falls back to compatibility mode when there's a string ' msg ' (msg with spaces on both sides) in it. Is this intentional? (Node-RED 3.1.3 on NodeJS 18 and 20) This means that this JSONata expression doesn't giv…

---

## [What is the correct way to use jsonata inside a switch node with "has key" rule?](https://discourse.nodered.org/t/what-is-the-correct-way-to-use-jsonata-inside-a-switch-node-with-has-key-rule/83616)

<div class="topic-metadata">

**Author:** [@alwinter](https://discourse.nodered.org/u/alwinter)\
**Replies:** 12\
**Last updated:** [12 December 2023 00:07 UTC](https://discourse.nodered.org/t/what-is-the-correct-way-to-use-jsonata-inside-a-switch-node-with-has-key-rule/83616 "2023-12-12T00:07:25Z")

</div>

Hi I have the following situation, I want to test if a given msg.payload has some keys. Let's say for example: msg.payload.keyOne msg.payload.keyTwo I know i can check that with a function node, but I'm curious about …

---

## [Switch node jsonata predicate match](https://discourse.nodered.org/t/switch-node-jsonata-predicate-match/82290)

<div class="topic-metadata">

**Author:** [@stevegroom](https://discourse.nodered.org/u/stevegroom)\
**Replies:** 2\
**Last updated:** [23 October 2023 16:55 UTC](https://discourse.nodered.org/t/switch-node-jsonata-predicate-match/82290 "2023-10-23T16:55:33Z")

</div>

I am trying to get a predicate match in a switch node to look up a device\_ieee and determine the device type - in this case Hue v1 or Hue v2. msg object has been supplemented with roominfo where the device\_ieee can be l…

---

## [$flowContext with req.params?](https://discourse.nodered.org/t/flowcontext-with-req-params/81395)

<div class="topic-metadata">

**Author:** [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Replies:** 3\
**Last updated:** [17 September 2023 10:51 UTC](https://discourse.nodered.org/t/flowcontext-with-req-params/81395 "2023-09-17T10:51:27Z")

</div>

I have a flow context object called testobject: { test1:\[{some content..}\], test2:\[{some other content..}\] } I want to use a change node to return the property that was requested via req.params.item req.params.item …

---

## [Change Node - Not sure how to Reference payload in Expression](https://discourse.nodered.org/t/change-node-not-sure-how-to-reference-payload-in-expression/79204)

<div class="topic-metadata">

**Author:** [@Quesnt](https://discourse.nodered.org/u/Quesnt)\
**Replies:** 4\
**Last updated:** [15 June 2023 18:00 UTC](https://discourse.nodered.org/t/change-node-not-sure-how-to-reference-payload-in-expression/79204 "2023-06-15T18:00:35Z")

</div>

Hi, Given the expression and input below using the Change node, the test function works fine however when running the trigger I get no output. I've looked at many other posts on here and suspect I am not properly refere…

---

## [Documentation for Jsonata usage in common Node-RED nodes](https://discourse.nodered.org/t/documentation-for-jsonata-usage-in-common-node-red-nodes/77715)

<div class="topic-metadata">

**Author:** [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Replies:** 8\
**Last updated:** [20 April 2023 07:35 UTC](https://discourse.nodered.org/t/documentation-for-jsonata-usage-in-common-node-red-nodes/77715 "2023-04-20T07:35:36Z")

</div>

I'm using Node-RED more and getting better with Javascript and using the Function Node. I have discovered by trying Jsonata on a very limited basis. NOW with recent improvements to the basics available in Node-RED ther…

---

## [JSONata filter array of strings](https://discourse.nodered.org/t/jsonata-filter-array-of-strings/76810)

<div class="topic-metadata">

**Author:** [@protonmw](https://discourse.nodered.org/u/protonmw)\
**Replies:** 3\
**Last updated:** [22 March 2023 10:44 UTC](https://discourse.nodered.org/t/jsonata-filter-array-of-strings/76810 "2023-03-22T10:44:19Z")

</div>

Sometimes JSONata is so hard to understand... how can i filter the string from the array that contains "bara" ? \["100.00barg","BAROMETER","101.00bara"\]

---

## [Update JSONata version 1.8.6 -\> 2.0.2+](https://discourse.nodered.org/t/update-jsonata-version-1-8-6-2-0-2/76798)

<div class="topic-metadata">

**Author:** [@robtigger0077](https://discourse.nodered.org/u/robtigger0077)\
**Replies:** 1\
**Last updated:** [22 March 2023 06:49 UTC](https://discourse.nodered.org/t/update-jsonata-version-1-8-6-2-0-2/76798 "2023-03-22T06:49:47Z")

</div>

Feature request, to update Node-Red from the current JSONata 1.8.6 to the latest 2.0+ version. Version 2.0.0 contains a breaking change to the Javascript API as a result of reimplementing the evaluator to use async fu…

---

## [Jsonata chain operator giving different results](https://discourse.nodered.org/t/jsonata-chain-operator-giving-different-results/76583)

<div class="topic-metadata">

**Author:** [@shimbone](https://discourse.nodered.org/u/shimbone)\
**Replies:** 3\
**Last updated:** [15 March 2023 18:36 UTC](https://discourse.nodered.org/t/jsonata-chain-operator-giving-different-results/76583 "2023-03-15T18:36:55Z")

</div>

Given some JSON: { "A": 1, "B" : 2, "C": 3 } I'd expect this Jasonata statement $spread($)\[\*=2\] to gives these results (which it does indeed): { "B": 2 } But when I use what I believe to be semantically th…

[Next page](https://discourse.nodered.org/tag/jsonata/68.md?match_all_tags=true&page=1&tags%5B%5D=jsonata)
