---
title: Classic Basic Transformation Options
slug: classic-basic-transformation-options
docTags: 
createdAt: 2025-08-11T11:13:45.000Z
---

The table shows advanced transformation options, summary. and provides easy to copy/paste examples. Want to write the code yourself?

You can use advanced transformations to write complex JSONata expressions, which gives you significant flexibility to transform data according to your needs. See [JSONata Docs](https://docs.jsonata.org/overview.html) to assist you in writing expressions.

For the list of Context Variables, see [Context Variables](#).

## Array transformation

### Flatten

Flatten an array containing potentially nested arrays to a single array.

**Example:**

:::BlockQuote
$arrayFlatten(\[1, 2, \[3, 4]]) => \[1, 2, 3, 4]
:::

::embed[``]{url="https://youtu.be/M9h8BykIT18"}

### PluckBy

Extract the values of a property or deeply nested property of the objects within an array of objects.

**Example:**

:::BlockQuote
$arrayPluckBy(\[\{ “color”: “Brown”, “type”: “Dog” },\{ “color”: “Beige”, “type”: “Cat” }],”type”) => \[“Dog”,”Cat”]
:::

::embed[``]{url="https://youtu.be/gYS2EqgN8m8"}

### Sort

Sort the items of an array of strings or numbers by value.

**Example:**

:::BlockQuote
$arraySort(\[3, 4, 1], “desc”) => \[4, 3, 1]
:::

::embed[``]{url="https://youtu.be/Fe42d12p8zI"}

### SortBy

Sort the items of an array of objects by the value of a plucked property of the objects within the array.

**Example:**

:::BlockQuote
$arraySortBy(
&#x20;         \[\{ “user”: \{ “name”: “Foo” } }, \{ “user”: \{ “name”: ”Bar” } }, \{ “user”: \{ “name”: “Around” } }],
&#x20;         “user.name”,
&#x20;         “asc”
&#x20;       ) => \[\{ “user”: \{ “name”: “Around” } }, \{ “user”: \{ “name”: “Bar” } }, \{ “user”: \{ “name”: “Foo” } }]
:::

::embed[]{url="https://youtu.be/d2u-ymV7p5o"}

### CountIf

Count all items of an array that are equal to a specific value.

**Example:**

:::BlockQuote
$arrayCountIf(\[43, 43, 41, 100], 43) => 2
:::

::embed[]{url="https://youtu.be/cXQXy6Ohj34"}

### CountIfBy

Count all items of an array of objects that contain a plucked property equal to a specific value.

**Example:**

:::BlockQuote
$arrayCountIfBy(
&#x9;\[\{ "lastName": "Doe" }, \{ "lastName": "Test" }, \{ "lastName": "Doe" }],&#x20;
&#x9;"lastName",&#x20;
&#x9;"Doe"
) => 2
:::

::embed[]{url="https://youtu.be/mIPYSuX6XAk"}

### Sum

Sum the values of an array of numbers.

**Example:**

:::BlockQuote
$arraySum(\[10, 30, 40]) => 80
:::

::embed[]{url="https://youtu.be/mqigOaaYQlo"}

### SumBy

Sum the values of a plucked property of the objects within an array of objects.

**Example:**

:::BlockQuote
$arraySumBy(\[\{ “age”: 10 }, \{ “age”: 30 }, \{ “age”: 40 }], “age”) => 80
:::

::embed[]{url="https://youtu.be/VrjJ7K1CCrA"}

### Avg

Average the values of an array of numbers.

**Example:**

:::BlockQuote
$arrayAvg(\[10, 30, 40]) => 26.6666
:::

::embed[]{url="https://youtu.be/Sm6lRfnjTsI"}

### AvgBy

Average the values of a plucked property of the objects within an array of objects.

**Example:**

:::BlockQuote
$arrayAvgBy(\[\{ “age”: 10 }, \{ “age”: 30 }, \{ “age”: 40 }], “age”) => 26.6666
:::

::embed[]{url="https://youtu.be/wcO4nlVkGLA"}

### Min

Find the minimum value in an array of numbers.

**Example:**

:::BlockQuote
$arrayMin(10, 30, 40]) => 10
:::

::embed[]{url="https://youtu.be/TA-rhJHRsQs"}

### MinBy

Find the minimum value of a plucked property of the objects within an array of objects.

**Example:**

:::BlockQuote
$arrayMinBy(\[\{ “age”: 10 }, \{ “age”: 30 }, \{ “age”: 40 }], “age”) => 10
:::

::embed[]{url="https://youtu.be/MEm1hKbnTkg"}

### Max

Find the maximum value in an array of numbers.

**Example:**

:::BlockQuote
$arrayMax(\[10, 30, 40]) => 40
:::

::embed[]{url="https://youtu.be/6IMmmLRuZZM"}

### MaxBy

Find the maximum value of a plucked property of the objects within an array of objects.

**Example:**

:::BlockQuote
$arrayMaxBy(\[\{ “age”: 10 }, \{ “age”: 30 }, \{ “age”: 40 }], “age”) => 40
:::

::embed[]{url="https://youtu.be/gtac37NaHwo"}

### Filter

Filter an array to the values that match a regular expression, a specific value, or non-null value.

**Example:**

:::BlockQuote
$arrayFilter(\[1, 2, 3, 4, 5, 3], 3) => \[3, 3]
:::

::embed[]{url="https://youtu.be/6KOicXChv1o"}

### FilterBy

Filter an array of objects to those that contain a property or deeply nested property whose values match a regular expression, a specific value, or non-null value.

**Example:**

:::BlockQuote
$arrayFilterBy(\[\{ “age”: 10 }, \{ “age”: 30 }, \{ “age”: 40 }], “age”, 10) => \[\{ “age”: 10 }]
:::

::embed[]{url="https://youtu.be/w5ym0ugM_A8"}

## Numeric transformations

### Round

Adjust a number rounding or flooring it.

**Example:**

:::BlockQuote
$numericRound(123.6, 0) => 124
:::

::embed[]{url="https://youtu.be/1BGoP0NwiVI"}

### Floor

Adjust a number flooring it.

**Example:**

:::BlockQuote
$numericFloor(1234, -1) => 1230
:::

::embed[]{url="https://youtu.be/Yn8xgTlecYc"}

### Ceil

Adjust a number ceiling it.

**Example:**

:::BlockQuote
$numericCeil(1234, -1) => 1240
:::

::embed[]{url="https://youtu.be/OZH8vp2TMck"}

### Absolute value

Compute the absolute value of a number.

**Example:**

:::BlockQuote
$numericAbs(-1) => 1
:::

::embed[]{url="https://youtu.be/Q--s_POPJYc"}

### Less than

Check if the first number is less than the second.

**Example:**

:::BlockQuote
$numericLessThan(2, 7) => true
:::

::embed[]{url="https://youtu.be/x55LJjX35GM"}

### Less than or equal

Check if the first number is less than or equal to the second.

**Example:**

:::BlockQuote
$numericLessThanOrEqual(20, 7) => false
:::

::embed[]{url="https://youtu.be/FGo4APkm5so"}

### Greater than

Check if the first number is greater than the second.

**Example:**

:::BlockQuote
$numericGreaterThan(2, 7) => false
:::

::embed[]{url="https://youtu.be/Zbr4h67pBrU"}

### Greater than or equal

Check if the first number is greater than or equal to the second.

**Example:**

:::BlockQuote
$numericGreaterThanOrEqual(7, 7) => true
:::

::embed[]{url="https://youtu.be/cu-UA053QQ8"}

### Random

Generate a random number between inclusive lower and upper bounds.

**Example:**

:::BlockQuote
$numericRandomBasic(1, 10, “No”) => 3
:::

::embed[]{url="https://youtu.be/urqtBVJNpF8"}

## Object transformations

### Remove

Remove a property on an object.

**Example:**

:::BlockQuote
$objectRemove(\{ “name”: “John” }, “name”) => \{}
:::

::embed[]{url="https://youtu.be/zsctWBWNkp0"}

### Is Equal

Perform a deep comparison between two values to determine if they are equivalent.

**Example:**

:::BlockQuote
$objectIsEqual(\{ “age”: 30, “name”: “joe” }, \{ “age”: 30, “name”: “joe” }) => true
:::

::embed[]{url="https://youtu.be/zHi1-UuWdlA"}

### Has By

Check if an object contains a property or deeply nested property.

**Example:**

`$objectHasBy({ key: 1 }, “key”) => true`

::embed[]{url="https://youtu.be/Pdlx1SE3TNY"}

### Pick

Create an object composed of the picked properties.

**Example:**

:::BlockQuote
$objectPick(\{ “person”: \{ “name”: “joe” }, “age”: 30 }, “age”) => \{ “age”: 30 }
:::

::embed[]{url="https://youtu.be/nseld7Nd4tU"}

### Pluck By

Extract the value of a property or deeply nested property of an object.

**Example:**

:::BlockQuote
$objectPluckBy(\{ “person”: \{ “name”: “joe” }, “age”: 30 }, “person.name”) => “joe”
:::

::embed[]{url="https://youtu.be/w-GCR_aZfl4"}

## String Transformations

### Strip

Remove all whitespace (tabs, spaces, and newlines) from both the left and right side of text. Spaces in between words will not be removed.

**Example:**

:::BlockQuote
$stringStrip(“  hello word  ”) => “hello word”
:::

::embed[]{url="https://youtu.be/ACyyiMeKY9k"}

### UUID v4

Generate a v4 universally unique identifier (UUID).

**Example:**

:::BlockQuote
$stringUuidv4() => “be407787-14e1-47d1-9b25-9eaa624f7a5f”
:::

::embed[]{url="https://youtu.be/P0C37iaBFKE"}

### Hash

Compute that hash of a value.

**Example:**

:::BlockQuote
$stringHash(“data”, “MD5”) => “8d777f385d3dfec8815d20f7496026dc”
:::

::embed[]{url="https://youtu.be/DTG2wbom3qU"}

### Pad

Pad a string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.

**Example:**

:::BlockQuote
$stringPad('abc', 8) => “  abc   “
:::

::embed[]{url="https://youtu.be/tf5EaxGVKKA"}

### Pad Start

Pad a string on the left side if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.

**Example:**

:::BlockQuote
$stringPadStart(“abc”, 5,”h”) => “hhabc”
:::

::embed[]{url="https://youtu.be/nRIp8Z05-aA"}

### Pad End

Pad a string on the right side if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.

**Example:**

`$stringPadEnd(“abc”, 5,”h”) => “abchh”`

::embed[]{url="https://youtu.be/yCyQTJi8uME"}

### Repeat

Repeat a string N times.

**Example:**

:::BlockQuote
$stringRepeat(“abc”, 2) => “abcabc”
:::

::embed[]{url="https://youtu.be/lLwXvLLNlqo"}

### Camel Case

Convert a string to camel case.

**Example:**

:::BlockQuote
$stringCamelCase(“hello world”) => “helloWorld”
:::

::embed[]{url="https://youtu.be/FTD9REF1T5E"}

### Capitalize

Convert the first character of a string to upper case and the remaining to lower case.

**Example:**

:::BlockQuote
$stringCapitalize(“hello world”) = “Hello world”
:::

::embed[]{url="https://youtu.be/N6l3nXsgnlU"}

### Starts With

Check if a string starts with another.

**Example:**

:::BlockQuote
$stringStartsWith(“abc”, “a”) => true
:::

::embed[]{url="https://youtu.be/qS2fB_xliVs"}

### Ends With

Check if a string ends with another.

**Example:**

:::BlockQuote
$stringEndsWith(“abc”, “c”) => true
:::

::embed[]{url="https://youtu.be/efL0-l4LhNU"}

### Eval Expression

Parse and evaluate a string containing literal JSON or a JSONata expression.

**Example:**

:::BlockQuote
$stringEvalExpression(“\[1,$string(number),3]”, \{ “number”: 2 }) => \[1,”'2”, 3]
:::

::embed[]{url="https://youtu.be/qIqtldnz99g"}

## Value Transformations

### Is Array

Check if value is an array.

**Example:**

:::BlockQuote
$valueIsArray(\[1, 4, 4]) => true
:::

::embed[]{url="https://youtu.be/1rqRGe0pTUY"}

### Is String

Check if value is a string.

**Example:**

:::BlockQuote
$valueIsString(“data”) => true
:::

::embed[]{url="https://youtu.be/ja2hzVN5PXA"}

### Is Null Or Undefined

Check if value is null or undefined.

**Example:**

:::BlockQuote
$valueIsNullOrUndefined(null) => true
:::

::embed[]{url="https://youtu.be/bLaB56bNUmw"}

### Is Object

Check if a value is an object.

**Example:**

:::BlockQuote
$valueIsObject(\{}) => true
:::

::embed[]{url="https://youtu.be/-TVc_4bLJ7g"}

### From XML

Parse an XML string.

**Example:**

:::BlockQuote
$valuesFromXml(“\<a/>”) => \{“a”: \{}}
:::

::embed[]{url="https://youtu.be/yCQ9NEDWaV8"}

### From YAML

Parse a YAML string.

**Example:**

:::BlockQuote
$valuesFromYaml(
          “version: 1.0.0\ndependencies:\n  yaml: ^1.10.0\npackage:\n  exclude:\n    - .idea/\*\*\n    - .gitignore\n”
       ) => 
\{  “version”: “1.0.0”, “dependencies”: \{ “yaml”: “^1.10.0”}, “package”: \{“exclude”: \[“.idea/\*\*”, “.gitignore”]}}
:::

::embed[]{url="https://youtu.be/DnNP86bTWX0"}

### From CSV

Parse a CSV string.

**Example:**

:::BlockQuote
$valueFromCsv(“eruid,description\nbatman,uses technology\nsuperman,flies through the air”) => \[
        \{ “description”: “uses technology”, “eruid”: “batman” },
        \{ “description”: “flies through the air', “eruid”: “superman” }
      ]
:::

::embed[]{url="https://youtu.be/xi_huIFg2y0"}

### To XML

Serialize a value to XML.

**Example:**

:::BlockQuote
$valuesToXml(\{ “a”: \{} }) => “\<a/>”
:::

::embed[]{url="https://youtu.be/yG_HfssknMM"}

### To YAML

Serialize a value to YAML.

**Example:**

:::BlockQuote
$valuesToYaml(\{
&#x20;         “version”: “1.0.0”,
&#x20;         “dependencies”: \{
&#x20;           “yaml”: “^1.10.0”
&#x20;         },
&#x20;         “package”: \{
&#x20;           “exclude”: \[“.idea/\*\*”, “.gitignore”]
&#x20;         }
&#x20;       }) => “version: 1.0.0\ndependencies:\n  yaml: ^1.10.0\npackage:\n  exclude:\n    - .idea/\*\*\n    - .gitignore\n”
:::

::embed[]{url="https://youtu.be/tvYpARf0rE4"}

### To CSV

Serialize a value to CSV.

**Example:**

:::BlockQuote
$valuesToCsv(\[
          \{ “eruid”: “batman”, “description”: “uses technology” },
          \{ “eruid”: “superman”, “description”: “flies through the air” }
]) => “eruid,description\nbatman,uses technology\nsuperman,flies through the air\n”
:::

::embed[]{url="https://youtu.be/Fa0ttaOkJc0"}

