Create Key
Creates a new key-value pair if the target key-value exists in the record.
Example
This example shows how to use the CreateKeyValueIfKeyValue transformation to add a new key-value pair to a record if another key-value pair exists.
{
"operation": "create_key_value_if_key_value",
"arguments": {
"key": "new_field",
"value": "new_value",
"key_to_watch": "existing_field",
"value_to_watch": "existing_value"
}
}
Given the input record:
{
"existing_field": "existing_value"
}
The output record will be:
{
"existing_field": "existing_value",
"new_field": "new_value"
}
If the input record does not contain the key_to_watch with the specified value_to_watch, no changes will be made to the record.