Using JSONata it is possible to perform different types of transformations with strings using various operators and string functions like $uppercase(str), $lowercase(str), $split(str, separator [, limit]), $joinarray[, separator] and many more.

To start with a simple example let us combine several values by concatenation. Assume the following incoming data:

{
  "author":"Mark Twain",
  "fname":"Tom",
  "lname":"Sawyer",
  "email":"tom.sawyer@twaincreations.com",
  "town":"StPetersburg",
  "state":"Missouri"
}

This incoming data is mapped into an outgoing data field. However, we can make transformations like this:

"The Adventures of " & fname & " " & lname

Which would result in:

Notice how the strings are combined with a message. Now we want to write the same sentence in all caps since it is a title of a book:

$uppercase("The Adventures of " & fname & " " & lname)

Resulting in:

THE ADVENTURES OF TOM SAWYER

How about adding the new line and adding the name of the author?

$uppercase("The Adventures of " & fname & " " & lname)
& "\n" & $uppercase("by " & author)

And the outcome is:

THE ADVENTURES OF TOM SAWYER
BY MARK TWAIN

What if we want to get only the domain name from the incoming email address tom.sawyer@twaincreations.com? To do that we could write the following JSONata expression:

$split(email, /[@,.]+/)[2]

This expression first takes the email, splits it using the @ and . characters to build an array with elements containing  ["tom","sawyer","twaincreations","com"]. Then it takes only the domain name value [2] to get the final result:

twaincreations

If you noticed the email address domain contains the author's surname. Can we be sure?

$contains(email,$lowercase($split(author,"")[1]))

Notice we first took the author field, split it into an array and took only the surname part (Twain). Then we converted it to lower case and used the value (twain) to check the email field if it contains that specific value. The answer is obviously:

true

More example of string functions and their implementation can be learned in JSONata documentation pages.