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 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. Using this operator, there are three 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 (empty strings look like "").

  • 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 3 options are:

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

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

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

Adding a Clean Object Operator

First, configure a Data Table component with sample values and a Data Workflow that generates nulls. 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:

    #

    value

    company

    1

    12

    Unqork

    2

    34

    Cvent

    3

    56

    Trustpilot

    4

    78

    BetterWorks

    5

    90

    J.P. Morgan

  4. Click Save.

Configure the Hidden Components

Before you can add your Data Workflow components, you'll need places to store their 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

  1. Save 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 below the dtSampleData Data Table component.

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

    A static image displaying the Property ID, Canvas Label Text, and the configuration of the dwfCreateNullValues 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

    dtSampleData

    Required

    Yes

    Source

    Default

Configure the Create Field Operator

This operator adds a new field testField 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 below the dataWithNullValues Hidden component.

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

    A static image displaying the Property ID, Canvas Label Text, and 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 is going to convert 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 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 both strings now.

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 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. Using this operator, there are three 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 (empty strings look like "").

  • 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.

Clean Action

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

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

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

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

Adding a Clean Object Operator

First, configure a Data Table component with sample values and a Data Workflow that generates nulls. 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:

    #

    value

    company

    1

    12

    Unqork

    2

    34

    Cvent

    3

    56

    Trustpilot

    4

    78

    BetterWorks

    5

    90

    J.P. Morgan

    A static image displaying the Property ID, Canvas Label Text, and Data Table of the dtSampleData Data Table component.

  4. Click Save.

Configure the Hidden Components

Before you can add your Data Workflow components, you'll need places to store their 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

  1. Save 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 below the dtSampleData Data Table component.

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

    A static image displaying the Canvas Label Text, Property Name, and the configuration of the dwfCreateNullValues 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

    dtSampleData

    Required

    Yes

    Source

    Default

Configure the Create Field Operator

This operator adds a new field testField 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 (Yes)

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 below the dataWithNullValues Hidden component.

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

    A static image displaying the Canvas Label Text, Property Name, and 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 Operator operator is going to convert 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:

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

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