Automation capabilities in the area of data transformation can be used to update and change large amounts of data in a fast, advanced way, eliminating the process of manually adjusting the whole file. All transformations are performed on a sample file in desired format.
In this use case, you will find out how to transform and import customer data from a .JSON file with data transformation and workflows.
In this use case, you will make the following modifications to the sample file:
- Edit Values:
- replace the value of the
cityattribute from blank tounknown; if thecityattribute is defined, keep the existing city, - replace the
en,es,frvalues of thelanguageattribute withEnglish,Spanish,French, respectively, - replace the value of
payment_cashandpayment_onlineattributes from1/0tocash/Nullandonline/Null.
- replace the value of the
- Merge
payment_cashandpayment_onlineattributes into thepayment_infoattribute.
Input data in use case
In this use case, we use two files:
- the complete
.JSONfile with your customer database. Make sure you include one of the required parameters:clientID, uuid, email, customId. If your workspace uses non-unique emails, usecustomIdoruuid. The only requirement for JSON files is that they must be UTF-8 encoded. - Prepare a sample JSON file with data you want to import. Below you will find an example how such a a file can look.
Example JSON file might look like this
{ "email": "test@test.com", "city": "", "language": "fr", "payment_cash": "1", "payment_online": "0" }, { "email": "test2@test.com", "city": "New York", "language": "en", "payment_cash": "0", "payment_online": "1" }NOTE: If your data is complete, you can skip transforming data. But if you need to modify the file with data before an import to Synerise, you can modify the data in Automation Hub > Transformations. To do so, create a sample of your data and include all attributes you want to modify. If you miss the attributes in the sample file, but import the actual data with them, the data will be imported as delivered in the actual file.
Process
- Prepare a transformation to transform the data in the file.
- Prepare a workflow to import the
.JSONfile to Synerise.
Create a transformation
In this part of the process, you define the rules of modifying data before sending it to Synerise, so the data is consistent. Each of the following sub-steps describes the individual changes performed on the file.
- Go to
Automation Hub > Transformations > New transformation.
- Enter the name of the transformation.
NOTE: Before you proceed with selecting sample data and defining transformation rules, optionally, you can select a goal to help you structure the data. If you want to create a transformation without a specific goal and you know the structure of the output data, skip this step.
Goals will suggest you the required fields needed to perform the import into Synerise.
Add input data
This step allows you to add a data sample. In further steps, you define how the data must be modified. Later, when this transformation is used in the workflow, the system uses the rules created with the sample data as a pattern for modifying actual data.
- Click Upload a new file or drag one here.
- Upload the
.JSONfile. - You can preview the file, then click Apply.
Result: The editor displays data from the sample.
Handle missing data
In this part of the process, use the Edit Values step to keep the existing city and replace blank values in the city column with unknown.
- On the right panel, click Add step and select Edit Values.
In the configuration of the step:
Select the city column.
- Under Edit values by, select Replacing.
- From the dropdown below, select Dynamic value.
- In the Type value field, paste the following Jinja code:
{% if root["city"] != "" %}{{ root["city"] }}{% else %}unknown{% endif %}

The configuration of the Edit Values step - Preview the changes in the Result tab.

- Confirm by clicking Apply.
Change data
As in the previous step, use Edit Values to modify the data. Add a separate rule for each of the remaining columns: language, payment_cash, and payment_online. Replace the language codes with language names and the payment flags with values that will be merged into payment_info.
On the right panel, select the previously created Edit Values step and click Add rule. In the configuration of the rule:
Select the language column.
- Under Edit values by, select Replacing.
- From the dropdown below, select Dynamic value.
- In the Type value field, paste the following Jinja code:
{% if root["language"] == "en" %}English{% elif root["language"] == "es"%}Spanish{% elif root["language"] == "fr"%}French{% endif %} - Preview the changes in the Result tab and click Apply.

The configuration of the Edit Values rule On the right panel, select the previously created Edit Values step and click Add rule. In the configuration of the rule:
Select the payment_cash column.
- Under Edit values by, select Replacing.
- From the dropdown below, select Dynamic value.
- In the Type value field, paste the following Jinja code:
{% if root["payment_cash"] == "1" %}cash{% elif root["payment_cash"] == "0"%}{% endif %} - Preview the changes in the Result tab and click Apply.
On the right panel, select the previously created Edit Values step and click Add rule. In the configuration of the rule:
Select the payment_online column.
- Under Edit values by, select Replacing.
- From the dropdown below, select Dynamic value.
- In the Type value field, paste the following Jinja code:
{% if root["payment_online"] == "1" %}online{% elif root["payment_online"] == "0"%}{% endif %} - Preview the changes in the Result tab and click Apply.
After applying the changes, you will get an updated file:

Merge Columns
Use the Merge Columns step to merge payment_cash and payment_online into one payment_info column.
- On the right panel, click Add step and select Merge Columns.
- In the configuration of the step:
- Select the payment_cash and payment_online columns.
- In the New column name field, enter
payment_info. - Enable Remove original columns.

- Preview the changes in the Result tab.

- Confirm by clicking Apply.
Preview and save the transformation
- Preview the final results in the Output tab.
- In the upper right corner, click Save.
Prepare a workflow
The scenario for this use case involves a one-time import of .JSON file with a customer database directly to Synerise.
- Go to
Automation Hub > Workflows > New workflow.
- Enter the name of the workflow.
Define the launch date
- As the trigger node, add Scheduled Run.
In the configuration of the node:
- Select the Run once option.
- Select Immediately.
- Confirm by clicking Apply.

The configuration of the Scheduled Run node
Select file to import
- Add the Local File node.
- In the configuration of the node:
- Upload the file.
- Confirm by clicking Apply.

Select the transformation
- Add a Data Transformation Studio node.
- In the configuration of the node, keep the default From workflow context option.
- In the editor, click Templates library:
- Select the transformation you have created before.
- Click Use template.
- Confirm by clicking Apply.

TIP: You can also create a transformation directly in the Data Transformation Studio node instead of selecting a template.
Add Import Profiles and finishing node
- Add the Import Profiles node.
- Optionally, in Advanced settings, you can change the import mode.
- Add the End node.
- In the upper right corner, click Save & Run.

The workflow configuration
Check the use case set up on the Synerise Demo workspace
You can check the Transformation and Workflow configurations directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the Synerise Demo workspace (1590), where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact form to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
Generated events
This use case generates approximately 5 events per workflow execution:
automation.clientStartPath (~1), automation.clientPathStep (~3), automation.clientEndPath (~1).