Product Features
...
Statistical Functions
JSONata Processor
5 min
the jsonata processor allows you to transform incoming json payloads using a specified jsonata schema by connecting multiple input processors to the jsonata processor, you can perform flexible queries and data transformations you must accurately define the input wires and jsonata expressions to ensure the correct mapping of fields in the incoming data jsonata processor overview jsonata is a flexible query and transformation language for json data the jsonata processor uses a specified jsonata schema to transform incoming payloads with the processor, you must define the correct input wires and jsonata expression to match you can use event and value wire types with the processor define your script in the code editor the editor is a user friendly interface for writing and editing jsonata expressions, supporting syntax highlighting and real time validation at the right you can access fullscreen show the code editor in full screen mode playground test, write, and validate processors in real time before deploying them validate validate your code examples using event wires as input when using the event wire type, there is no need to specify the wire name when defining the fields in the jsonata expression you can define multiple inputs into a single jsonata process however, each input is considered as it’s own process flow and generates a new payload input payload { "datatype" "float64", "description" "", "deviceid" "75f601ca 0f7a 4c26 90f0 470e2424bac1", "devicename" "gen", "metadata" {}, "registerid" "d5dcf52f 342b 4211 8f4f b92e4406bc4c", "success" true, "tagname" "tag1", "timestamp" 1739558895577, "value" 0 38164469548275337 } jsonata expression in this example, you simply define the field name from the input in the expression { "metric" $substring(tagname,3), "value" value, "date" $frommillis(timestamp, '\[m01]/\[d01]/\[y0001] \[h#1] \[m01]\[p]') } output payload { "date" "02/14/2025 6 51pm", "metric" "1", "value" 0 38164469548275337 } using value wires as input when using the value wire type, every input field must be a prefix wire name the jsonata processor will not produce a payload until all input payloads are present for example, the payload from input 1 is stored in memory until input 2 produces a payload input payload 1 // wirename = input 1 { "datatype" "float64", "description" "current metric", "deviceid" "75f601ca 0f7a 4c26 90f0 470e2424bac1", "devicename" "gen", "metadata" {}, "registerid" "d5dcf52f 342b 4211 8f4f b92e4406bc4c", "success"\ true, "tagname" "tag1", "timestamp" 1739558895577, "value" 0 38164469548275337 } input payload 2 //wirename = input 2 { "datatype" "float64", "description" "temp metric", "deviceid" "75f601ca 0f7a 4c26 90f0 470e2424bac1", "devicename" "gen", "metadata" {}, "registerid" "d5dcf52f 342b 4211 8f4f b92e4406bc4c", "success"\ true, "tagname" "tag2", "timestamp" 1739558895577, "value" 1 8813568907902232 } output payload { "metric 1" tsg1, "metric 2" tag2, "value 1" 0 38164469548275337, value 2" 1 8813568907902232, "date" "date" "02/14/2025 6 51pm" }