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

Behaviour

Behaviour
FieldTypeRequiredDescription
autoboolean (bool)Allows auto-conversion, which helps when there are many fields.
Default: false
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.
Default: false

Formatting

Formatting
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

General

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

Mappings

Mappings
FieldTypeRequiredDescription
conversionsConversions[]Simple conversions.
unitsUnits[]Unit conversions.

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, ssv-to-array, tsv-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, gigabits, gigabits-per-second, …
fromFromoptional unit we are converting from.
Allowed values: bits, bits-per-second, bytes, bytes-per-second, days, exabytes, gibibytes, gibits, gigabits, gigabits-per-second, …

Null Behaviour Options

ValueNameDescription
keepkeepPass through null or empty values
defaultdefaultConvert bool fields to false, num fields to 0 or str fields to an empty string

Format Options

ValueNameDescription
currencycurrencyCurrency
percentpercentPercent
comma-numbercomma-numberComma Number
plainplainPlain

Preprocess Options

ValueNameDescription
trimtrimTrim
strip-whitespacestrip-whitespaceStrip Whitespace
remove-currency-literalremove-currency-literalRemove Currency Literal
remove-percent-literalremove-percent-literalRemove Percent Literal
remove-thousands-separatorremove-thousands-separatorRemove Thousands Separator

On Error Options

ValueNameDescription
warnwarnWarn
defaultdefaultDefault
dropdropDrop

Conversions - Conversion Options

ValueNameDescription
strstrStr
numnumNum
jsonjsonJson
bytes-to-stringbytes-to-stringBytes To String
boolboolBool
arrayarrayArray
splitsplitSplit
csv-to-arraycsv-to-arrayCsv To Array
ssv-to-arrayssv-to-arraySsv To Array
tsv-to-arraytsv-to-arrayTsv To Array
nullnullNull
urlurlUrl
autoautoAuto

Units - To Options

ValueNameDescription
bitsbitsBits
bits-per-secondbits-per-secondBits Per Second
bytesbytesBytes
bytes-per-secondbytes-per-secondBytes Per Second
daysdaysDays
exabytesexabytesExabytes
gibibytesgibibytesGibibytes
gibitsgibitsGibits
gigabitsgigabitsGigabits
gigabits-per-secondgigabits-per-secondGigabits Per Second
gigabytesgigabytesGigabytes
gigabytes-per-secondgigabytes-per-secondGigabytes Per Second
hourshoursHours
kibibyteskibibytesKibibytes
kibitskibitsKibits
kilobitskilobitsKilobits
kilobits-per-secondkilobits-per-secondKilobits Per Second
kilobyteskilobytesKilobytes
kilobytes-per-secondkilobytes-per-secondKilobytes Per Second
mebibytesmebibytesMebibytes
megabitsmegabitsMegabits
megabits-per-secondmegabits-per-secondMegabits Per Second
megabytesmegabytesMegabytes
megabytes-per-secondmegabytes-per-secondMegabytes Per Second
mibitsmibitsMibits
microsecondsmicrosecondsMicroseconds
millisecondsmillisecondsMilliseconds
minutesminutesMinutes
nanosecondsnanosecondsNanoseconds
petabytespetabytesPetabytes
secondssecondsSeconds
tebibytestebibytesTebibytes
terabitsterabitsTerabits
terabits-per-secondterabits-per-secondTerabits Per Second
terabytesterabytesTerabytes
terabytes-per-secondterabytes-per-secondTerabytes Per Second
tibitstibitsTibits

Units - From Options

ValueNameDescription
bitsbitsBits
bits-per-secondbits-per-secondBits Per Second
bytesbytesBytes
bytes-per-secondbytes-per-secondBytes Per Second
daysdaysDays
exabytesexabytesExabytes
gibibytesgibibytesGibibytes
gibitsgibitsGibits
gigabitsgigabitsGigabits
gigabits-per-secondgigabits-per-secondGigabits Per Second
gigabytesgigabytesGigabytes
gigabytes-per-secondgigabytes-per-secondGigabytes Per Second
hourshoursHours
kibibyteskibibytesKibibytes
kibitskibitsKibits
kilobitskilobitsKilobits
kilobits-per-secondkilobits-per-secondKilobits Per Second
kilobyteskilobytesKilobytes
kilobytes-per-secondkilobytes-per-secondKilobytes Per Second
mebibytesmebibytesMebibytes
megabitsmegabitsMegabits
megabits-per-secondmegabits-per-secondMegabits Per Second
megabytesmegabytesMegabytes
megabytes-per-secondmegabytes-per-secondMegabytes Per Second
mibitsmibitsMibits
microsecondsmicrosecondsMicroseconds
millisecondsmillisecondsMilliseconds
minutesminutesMinutes
nanosecondsnanosecondsNanoseconds
petabytespetabytesPetabytes
secondssecondsSeconds
tebibytestebibytesTebibytes
terabitsterabitsTerabits
terabits-per-secondterabits-per-secondTerabits Per Second
terabytesterabytesTerabytes
terabytes-per-secondterabytes-per-secondTerabytes Per Second
tibitstibitsTibits