Clean Object Operator

Prev Next

A static image displaying the Clean Object operator with its Info window.

The Clean Object operator helps sanitize data by removing null values, converting them to empty strings, or transforming all values into strings. This operator is especially useful when preparing data for APIs, which can be sensitive to unexpected or incorrect field types. For example, an API call might fail if a field receives a null or a string instead of a number. Use this operator to ensure the data you send is clean and compatible.

There are various ways you can clean a data object:

  • Omit Null: Removes any fields with a null value.

  • Set Null to Empty String: Converts all null values to empty strings ("").

  • Convert All to String: Converts all values to strings.

All of these action types clean up the entire data object, including any nested objects.

You'll find the Clean Object operator under the Object Operators group to the left of your Data Workflow canvas.

About the Info Window

Here's a breakdown of each setting in the Info window:

Setting

Description

Category

Grayed out and non-adjustable setting indicating the operation type.

Label

Sets the label for your operator, displaying below the operator on your Data Workflow canvas.

This field is optional, but set a label if you use more than one of the same operator type. A label helps you identify your operators without opening any Info windows.

Preserve Argument Type

When selected, this setting ensures the argument data type is respected when the operator executes.

Clean Action

Sets the type of action the operator performs. The three options are:

  • Omit Null: Removes any fields with a null value.

  • Set Null to Empty String: Converts all null values to empty strings ("").

  • Convert All to String: Converts all values to strings.

Adding a Clean Object Operator

First, configure a Data Table component with sample values so you can use a Data Workflow to generate null values. Use the Convert All to String action type to observe how numbers and nulls are converted to strings.

Configure the Data Table Component

Configure a Data Table component with companies and their values.

  1. In the Module Builder, drag and drop a Data Table component onto your canvas.

  2. In the Property ID field, enter dtSampleData.

  3. In the data table, enter the following:

    A

    B

    1

    value

    company

    2

    12

    Unqork

    3

    34

    Cvent

    4

    56

    Trustpilot

    5

    78

    BetterWorks

    6

    90

    J.P. Morgan

    A static image displaying the dtSampleData Data table.

  4. Click Save Component.

Configure the Hidden Components

Before you add your Data Workflow components, you'll need components to store the outputs. You'll use two Hidden components, one for each Data Workflow.

  1. Drag and drop two Hidden components onto your canvas, placing them below the dtSampleData Data Table component.

  2. Enter the following Property ID and Canvas Label Text values:

    Property ID

    Canvas Label Text

    dataWithNullValues

    dataWithNullValues

    allStrings

    allStrings

  3. Click Save Component for each component as you add it.

Configure the First Data Workflow Component

  1. Drag and drop a Data Workflow component onto your canvas, placing it between the dtSampleData Data Table and Hidden components.

  2. In the Property ID and Canvas Label Text fields, enter dwfCreateNullValues.

    A static image displaying the configuration of the dwfCreateNullValues Data Workflow.

Configure the Input Operator

  1. Drag and drop an Input operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Input

    Component

    dtSampleData

    Required

    Yes

    Source

    Default

Configure the Create Field Operator

This operator adds a new testField field with a value of null to each object in the data.

  1. Drag and drop a Create Field operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Formula

    Label

    testField=NULL

    Do Not Sanitize Formula

    (checked)

    Field 1

    testField=NULL

    Field 2

    Field 3

    Field 4

    Field 5

  3. Connect the output port (right) of the dtSampleData Input operator to the input port (left) of the testField=NULL Create Field operator.

Configure the Output Operator

  1. Drag and drop an Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Output

    Component

    dataWithNullValues

    Action

    value

  3. Connect the output port (right) of the testField=NULL Create Field operator to the input port (left) of the dataWithNullValues Output operator.

  4. Click Save.

Configure the Second Data Workflow Component

  1. Drag and drop another Data Workflow component onto your canvas, placing it between the dataWithNullValues and allStrings Hidden components.

  2. In the Property ID and Canvas Label Text fields, enter dwfCleanObject.

    A static image displaying the configuration of the dwfCleanObject Data Workflow.

Configure the Input Operator

  1. Drag and drop an Input operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Input

    Component

    dataWithNullValues

    Required

    Yes

    Source

    Default

Configure the Clean Object Operator

The Clean Object operator converts all the values from the dataWithNullValues Input operator.

  1. Drag and drop a Clean Object operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Clean Object

    Label

    Convert to String

    Clean Action

    Convert all to String

  3. Connect the output port (right) of the dataWithNullValues Input operator to the input port (left) of the Convert to String Clean Object operator.

Configure the Output Operator

  1. Drag and drop an Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Output

    Component

    allStrings

    Action

    value

  3. Connect the output port (right) of the Convert to String Clean Object operator to the input port (left) of the allStrings Output operator.

  4. Click Save Component.

  5. Save your module.

Here's how the completed example looks in the Module Builder:

A static image displaying the Module Definition created for the use case to explain the Clean Object operator.

Preview your module in Express View and open the DevTools Console. You'll see that the number and null values are now strings.

A static image displaying the Express View and the DevTools Console of the configuration we build in the Module Builder.

A static image displaying the Clean Object and its Info window.The Clean Object operator helps sanitize data by removing null values, converting them to empty strings, or transforming all values into strings. This operator is especially useful when preparing data for APIs, which can be sensitive to unexpected or incorrect field types. For example, an API call might fail if a field receives a null or a string instead of a number. Use this operator to ensure the data you send is clean and compatible.

There are various ways you can clean a data object:

  • Omit Null: Removes any fields with a null value.

  • Set Null to Empty String: Converts all null values to empty strings ("").

  • Convert All to String: Converts all values to strings.

All of these action types clean up the entire data object, including any nested objects.

You'll find the Clean Object operator under the Object Operators group to the left of your Data Workflow canvas.

About the Info Window

Here's the breakdown of each setting in the Info window:

Setting

Description

Category

Grayed out and non-adjustable setting indicating the operation type.

Label

Sets the label for your operator, displaying below the operator on your Data Workflow canvas.

This field is optional, but set a label if you use more than one of the same operator type. A label helps you identify your operators without opening any Info windows.

Preserve Argument Type

When selected, this setting ensures the argument data type is respected when the operator executes.

Clean Action

Sets the type of action the operator performs. The three options are:

  • Omit Null: Removes any fields with a null value.

  • Set Null to Empty String: Converts all null values to empty strings ("").

  • Convert All to String: Converts all values to strings.

Adding a Clean Object Operator

First, configure a Data Table component with sample values so you can use a Data Workflow to generate null values. Use the Convert All to String action type to observe how numbers and nulls are converted to strings.

Configure the Data Table Component

Configure a Data Table component with companies and their values.

  1. In the Module Builder, drag and drop a Data Table component onto your canvas.

  2. In the Property ID and Canvas Label Text fields, enter dtSampleData.

  3. In the data table, enter the following:

    #

    A

    B

    1

    value

    company

    2

    12

    Unqork

    3

    34

    Cvent

    4

    56

    Trustpilot

    5

    78

    BetterWorks

    6

    90

    J.P. Morgan

    A static image displaying the dtSampleData Data Table configuration.

  4. Click Save & Close.

Configure the Hidden Components

Before you add your Data Workflow components, you'll need components to store the outputs. You'll use two Hidden components, one for each Data Workflow.

  1. Drag and drop two Hidden components onto your canvas, placing them below the dtSampleData Data Table component.

  2. Enter the following Property ID and Canvas Label Text values:

    Property ID

    Canvas Label Text

    dataWithNullValues

    dataWithNullValues

    allStrings

    allStrings

  3. Save & Close each component as you add it.

Configure the First Data Workflow Component

  1. Drag and drop a Data Workflow component onto your canvas, placing it between the dtSampleData Data Table and Hidden components.

  2. In the Canvas Label Text and Property Name fields, enter dwfCreateNullValues.

    A static image displaying the configuration of the dwfCreateNullValues Data Workflow.

Configure the Input Operator

  1. Drag and drop an Input operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Input

    Component

    dtSampleData

    Required

    Yes

    Source

    Default

Configure the Create Field Operator

This operator adds a new testField field with a value of null to each object in the data.

  1. Drag and drop a Create Field operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Formula

    Label

    testField=NULL

    Do Not Sanitize Formula

    (checked)

    Field 1

    testField=NULL

    Field 2

    Field 3

    Field 4

    Field 5

  1. Connect the output port (right) of the dtSampleData Input operator to the input port (left) of the testField=NULL Create Field operator.

Configure the Output Operator

  1. Drag and drop an Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Output

    Component

    dataWithNullValues

    Action

    value

  3. Connect the output port (right) of the testField=NULL Create Field operator to the input port (left) of the dataWithNullValues Output operator.

  4. Click Save.

Configure the Second Data Workflow Component

  1. Drag and drop another Data Workflow component onto your canvas, placing it between the dataWithNullValues and allStrings Hidden components.

  2. In the Canvas Label Text and Property Name fields, enter dwfCleanObject.

    A static image displaying the configuration of the dwfCleanObject Data Workflow component.

Configure the Input Operator

  1. Drag and drop an Input operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Input

    Component

    dataWithNullValues

    Required

    Yes

    Source

    Default

Configure the Clean Object Operator

The Clean Object operator converts all the values from the dataWithNullValues Input operator.

  1. Drag and drop a Clean Object operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Clean Object

    Label

    Convert to String

    Clean Action

    Convert all to String

  3. Connect the output port (right) of the dataWithNullValues Input operator to the input port (left) of the Convert to String Clean Object operator.

Configure the Output Operator

  1. Drag and drop an Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Output

    Component

    allStrings

    Action

    value

  3. Connect the output port (right) of the Convert to String Clean Object operator to the input port (left) of the allStrings Output operator.

  4. Click Save.

  5. Save your module.

Here's how the completed example looks in the Module Builder:

A static image displaying the module definition used to explain the Clean Object operator.

Preview your module in Express View and open the DevTools Console. You'll see that the number and null values are now strings.

A static image displaying the Express View and the DevTools Console of the configuration we build in the Module Builder.