Replace Field Names In List
The replace field names in list block replaces the field names used in a list with another field name.
A replace field names in list block is commonly used in the following situation:
- When an automation contains a list, and you want to change one or more of the field names.
Configuring a replace field names in list block
Configure the replace filed names in list block to replace existing field names with new field names.
List blocks do not use iterators. This means that lists are loaded in memory before doing the processing of any data. If your automation contains large lists, the automation might fail with an out-of-memory error. Instead, use a loop block to iterate through large lists.
Inputs
The replace field names in list block requires a list and a field name to replace. The list can be field mapped from a preceding block. Enter the field name to replace and the new field name.
Settings
The Settings tab is where you can tell the block to either keep or remove the all other field names in the list. If you choose to remove them, the new list only contains the items for field names you replaced.
Example of replacing field names in a list
Input list:
[
{"mail": "john@doe.com", "fname": "John", "lname": "Doe"},
{"mail": "bill@acme.com", "fname": "Bill", "lname": "Davis" }
]
The list above is the input list. It contains two objects with three key-value pairs. The new field name is email
and all values {$.inputs.mail}
are replaced with the new field name.
The replace field names in list block produces the following list:
[
{"email": "john@doe.com", "fname": "John", "lname": "Doe"},
{"email": "bill@acme.com", "fname": "Bill", "lname": "Davis" }
]