Skip to content

JSON Transformation

The JSON Transformation action lets you reshape and transform JSON data using a template-based syntax. It uses the JUST (JSON Under Simple Transformation) library with a set of built-in custom functions for working with jobs, artifacts, dates, strings, and more.

When to use this

  • You need to map data from one JSON structure to another
  • You want to transform API responses into a format your next action expects
  • You need to enrich or filter JSON data as part of a job workflow

How it works

You write a transformation template that defines the output structure. Inside the template, you use expressions to reference and transform values from the input JSON. The template is processed against the output of the previous action.

For the full JUST transformation syntax, refer to the JUST documentation.

Custom functions

In addition to the standard JUST syntax, the following custom functions are available inside transformation templates.

Job management

FunctionDescription
RunJob(jobGuid, jobRunGuid, input, inputFiles, variables, verbose, waitForCompletion, name)Execute another job
MakeHttpRequest(url, token, method, headers, body, contentType, numberOfRetries, responseErrorText)Send an HTTP request
GetInput(jobRunGuid, position)Get the output from a specific action by position
UpdateJobParameter(jobGuid, parameterName, value)Update a job parameter
ReadJobParameter(jobGuid, parameterName)Read a job parameter value
UpdateJobRunVariable(jobRunGuid, variableName, value)Set or update a job run variable
ReadJobRunVariable(jobRunGuid, variableName)Read a job run variable

JSON and data manipulation

FunctionDescription
ParseJson(json)Parse a JSON string into an object
GetParsedJsonValue(json, property)Get a specific property from parsed JSON
AddOrReplaceJsonArray(arr1, arr2, key)Merge two arrays by a key field
SortJsonArray(array, sortField, sortOrder)Sort an array by a field
ConvertToString(obj, sourceFormat)Convert an object to string
ConvertToJson(input, sourceFormat, ...)Convert from various formats to JSON
ConvertToXml(input, sourceFormat, rootName, ...)Convert data to XML
ConvertFromExcel(jobRunGuid, artifactName, targetFormat)Convert an Excel artifact

String operations

FunctionDescription
Replace(term, replaceTerm, replacementTerm)Replace text in a string
Split(term, splitCharacter, position)Split a string and return the part at position
SplitToArray(term, splitCharacter)Split a string into an array
FlattenArray(arr, separator)Join array elements into a string
FlattenJsonArray(arr, valueNames, valueSeparator, separator)Flatten an array of objects into a string
ToLowerCase(value)Convert to lowercase
ToUpperCase(value)Convert to uppercase
Capitalize(str)Capitalize each word
EncodeHtml(term)HTML-encode a string
DecodeHtml(term)HTML-decode a string
EncodeUrl(term)URL-encode a string
DecodeUrl(term)URL-decode a string
EncodeToBase64String(str)Base64-encode a string
DecodeFromBase64String(str)Base64-decode a string
GetStringHash(value)Get the SHA256 hash of a string
ClearTextFormatting(text)Strip HTML tags from text
ConstantSlash()Returns /

Date and time

FunctionDescription
ConvertToDate(date)Parse a string to a date
ConvertDateToTicks(date)Convert a date to ticks
ConvertDateFormat(date, format)Format a date with a custom pattern
ConvertTimeFromUtc(date, timezoneId)Convert from UTC to a specific timezone
ConvertTimeToUtc(date, timezoneId)Convert from a timezone to UTC
AddToDate(date, days, hours, minutes, seconds)Add time to a date
CompareDates(date1, date2)Compare two dates
GetFirstDateOfWeek(date)Get Monday of the given date's week
GetLastDateOfWeek(date)Get Sunday of the given date's week
GetFirstDateOfMonth(date)Get the first day of the month
GetLastDateOfMonth(date)Get the last day of the month
GetDatePart(date, datePart)Extract a part: year, month, day, dayofweek, week, hour, minute, second
GetDateDiff(startDate, endDate, diffType)Get the difference in days, hours, minutes, seconds, or ticks

Artifacts

FunctionDescription
GetArtifact(jobRunGuid, artifactName)Get artifact metadata
GetArtifactContent(jobRunGuid, artifactName)Get the content of an artifact
SaveArtifact(jobRunGuid, artifactName, content, contentType)Save content as an artifact
DeleteArtifact(jobRunGuid, artifactName)Delete an artifact
UploadArtifact(jobRunGuid, url, token, artifactName, useMultipart)Upload an artifact to an external URL
DownloadArtifact(jobRunGuid, url, token, artifactName)Download a file and save as artifact
ExtractArtifact(jobRunGuid, artifactName, password)Extract a ZIP or encrypted archive

PDF and QR codes

FunctionDescription
GeneratePdf(jobRunGuid, html, artifactName)Generate a PDF from HTML content
ExtractPdfPages(jobRunGuid, extractType, artifactName, searchTerm, ...)Extract content from a PDF
GenerateQrCode(jobRunGuid, content, pixelsPerModule, drawQuietZones, artifactName)Generate a QR code image

Cryptography

FunctionDescription
Encrypt(salt, str, encryption)Encrypt using HMACSHA256, SHA512, or SHA256
GetClientAssertion(pem, aud, iss, sub, scope)Generate a JWT client assertion
MathModulus(a, b)Modulo operation

Control flow

FunctionDescription
Not(condition)Boolean NOT
RaiseError(errorMessage)Stop the job with an error

Tips

TIP

Use ReadJobRunVariable and UpdateJobRunVariable to share state between actions. Variables persist for the duration of the job run.

TIP

Use GetInput with a position number to reference output from any earlier action, not just the previous one.

Common mistakes

WARNING

Custom functions in JSON Transformation do not use the _ prefix. Use RunJob(...) directly, not _RunJob(...). The underscore prefix is only for the JavaScript action.

WARNING

The jobRunGuid parameter is required for many functions (artifacts, variables, input). Make sure it's available in your transformation context.