Skip to content

Convert

Convert (convert)

Convert fields from one type to another, supporting simple and unit conversions Convert fields from one type to another, e.g. strings to numbers.

Transform json

Minimal example

actions:
- convert: {}
JSON
{
"actions": [
{
"convert": {}
}
]
}

Contents

Fields

FieldTypeRequiredDescription
description Generalstringdescribe this step.
condition Generallua-expression (string)Only run this action if the specified condition is met.
Examples: 2 * count()
auto Behaviourboolean (bool)Allows auto-conversion, which helps when there are many fields.
null-behaviour BehaviourNull BehaviourControls what occurs when a field’s value is null or empty.
Allowed values: keep, default
conversions MappingsConversions[]Simple conversions.
units MappingsUnits[]Unit conversions.
format FormattingFormatApply a predefined format template before conversion.
Allowed values: currency, percent, comma-number, plain
preprocess FormattingPreprocess[]Preprocess operations applied before conversion.
Allowed values: trim, strip-whitespace, remove-currency-literal, remove-percent-literal, remove-thousands-separator
on-error FormattingOn ErrorBehaviour when conversion fails.
Allowed values: warn, default, drop
suppress-warnings Behaviourboolean (bool)Suppress warnings generated by this action.

General

Show fields
FieldTypeRequiredDescription
descriptionstringdescribe this step.
conditionlua-expression (string)Only run this action if the specified condition is met.
Examples: 2 * count()

Behaviour

Show fields
FieldTypeRequiredDescription
autoboolean (bool)Allows auto-conversion, which helps when there are many fields.
null-behaviourNull BehaviourControls what occurs when a field’s value is null or empty.
Allowed values: keep, default
suppress-warningsboolean (bool)Suppress warnings generated by this action.

Mappings

Show fields
FieldTypeRequiredDescription
conversionsConversions[]Simple conversions.
unitsUnits[]Unit conversions.

Formatting

Show fields
FieldTypeRequiredDescription
formatFormatApply a predefined format template before conversion.
Allowed values: currency, percent, comma-number, plain
preprocessPreprocess[]Preprocess operations applied before conversion.
Allowed values: trim, strip-whitespace, remove-currency-literal, remove-percent-literal, remove-thousands-separator
on-errorOn ErrorBehaviour when conversion fails.
Allowed values: warn, default, drop

Schema

Conversions Fields

FieldTypeRequiredDescription
fieldstringevent field to be converted in-place.
conversionConversionconversion operation.
Allowed values: str, num, json, bytes-to-string, bool, array, split, csv-to-array, …

Units Fields

FieldTypeRequiredDescription
fieldstringevent field to be converted in-place.
toTothe unit we are converting to.
Allowed values: bits, bits-per-second, bytes, bytes-per-second, days, exabytes, gibibytes, gibits, …
fromFromoptional unit we are converting from.
Allowed values: bits, bits-per-second, bytes, bytes-per-second, days, exabytes, gibibytes, gibits, …

Null Behaviour Options

ValueDescription
keepPass through null or empty values
defaultConvert bool fields to false, num fields to 0 or str fields to an empty string

Conversions - Conversion Options

ValueDescription
strStr
numNum
jsonJson
bytes-to-stringBytes To String
boolBool
arrayArray
splitSplit
csv-to-arrayCsv To Array
ssv-to-arraySsv To Array
tsv-to-arrayTsv To Array
nullNull
urlUrl
autoAuto

Units - To Options

ValueDescription
bitsBits
bits-per-secondBits Per Second
bytesBytes
bytes-per-secondBytes Per Second
daysDays
exabytesExabytes
gibibytesGibibytes
gibitsGibits
gigabitsGigabits
gigabits-per-secondGigabits Per Second
gigabytesGigabytes
gigabytes-per-secondGigabytes Per Second
hoursHours
kibibytesKibibytes
kibitsKibits
kilobitsKilobits
kilobits-per-secondKilobits Per Second
kilobytesKilobytes
kilobytes-per-secondKilobytes Per Second
mebibytesMebibytes
megabitsMegabits
megabits-per-secondMegabits Per Second
megabytesMegabytes
megabytes-per-secondMegabytes Per Second
mibitsMibits
microsecondsMicroseconds
millisecondsMilliseconds
minutesMinutes
nanosecondsNanoseconds
petabytesPetabytes
secondsSeconds
tebibytesTebibytes
terabitsTerabits
terabits-per-secondTerabits Per Second
terabytesTerabytes
terabytes-per-secondTerabytes Per Second
tibitsTibits

Units - From Options

ValueDescription
bitsBits
bits-per-secondBits Per Second
bytesBytes
bytes-per-secondBytes Per Second
daysDays
exabytesExabytes
gibibytesGibibytes
gibitsGibits
gigabitsGigabits
gigabits-per-secondGigabits Per Second
gigabytesGigabytes
gigabytes-per-secondGigabytes Per Second
hoursHours
kibibytesKibibytes
kibitsKibits
kilobitsKilobits
kilobits-per-secondKilobits Per Second
kilobytesKilobytes
kilobytes-per-secondKilobytes Per Second
mebibytesMebibytes
megabitsMegabits
megabits-per-secondMegabits Per Second
megabytesMegabytes
megabytes-per-secondMegabytes Per Second
mibitsMibits
microsecondsMicroseconds
millisecondsMilliseconds
minutesMinutes
nanosecondsNanoseconds
petabytesPetabytes
secondsSeconds
tebibytesTebibytes
terabitsTerabits
terabits-per-secondTerabits Per Second
terabytesTerabytes
terabytes-per-secondTerabytes Per Second
tibitsTibits

Format Options

ValueDescription
currencyCurrency
percentPercent
comma-numberComma Number
plainPlain

Preprocess Options

ValueDescription
trimTrim
strip-whitespaceStrip Whitespace
remove-currency-literalRemove Currency Literal
remove-percent-literalRemove Percent Literal
remove-thousands-separatorRemove Thousands Separator

On Error Options

ValueDescription
warnWarn
defaultDefault
dropDrop