How to use Key mapper

Table Of Contents

  • General description
  • The different parts of the Key Mapper
  • Guide
  • Video guide

General description

The Key Mapper can be used to resolve data inconsistencies between different systems. For example, if the received data contains the key foo and the target system contains bar, the Key Mapper can be used to bridge the discrepancy. It can also be used to apply a whole array of actions to modify the keys in the data.

The different parts of the Key Mapper

  • Accessor (Required field)
    The accessor defines how the Transformer locates the key(s) that need to be transformed. Several kinds of accessor are available, which work based on given paths in the data and expressions to search.

    • Children accessor
      This works as a wrapper to group multiple accessors.
    • Key accessor
      Filters to apply a Mapper to one or more keys.
      • Root: Starting path where the lookup starts.
      • Keys: Names of the keys that need to be filtered.
    • Pattern accessor
      Finds keys using a JMESPath search pattern.
      • Pattern: Search pattern to identify keys.
      • Keys: Names of the keys that need to be filtered.
    • Structure accessor
      Locates keys and values in structured data.
      • Key: Key name or path to the keys.
      • Value: Path to the value.
      • Root: Starting path for the lookup.
  • Mappers
    The Mappers field contains tools that will be applied to the matched key(s). For example, one or multiple mappers can be configured to rename or convert keys in the context data. A Mapper is the data transformation action that takes place on the data found by the accessor.

  • Strip enclosures from keys
    Enclosures are used when a key contains a dot. For example, “product.name” becomes “product.name”. This can prevent comparators from working as expected (e.g., matching the beginning of a string in a PCRE expression).

Guide

Here’s how you can implement the transformer.

Step 1: Click on Add Data Transformer and select Key Mapper transformer.

Step 2: Select Key Accessor under Accessor.

Step 3: Click on Add Mappers under Mappers and select Dictionary Map.

Step 4: Click on Add Map and then fill up the fields you want to map for a certain data type. You can add multiple maps depending on your requirement.

Step 4: The keys will be mapped and updated by the transformer. You can visualize the same by clicking on the Run Test button.

Video guide