Skip to main content
The Key Mapping command (Command Type: 1005) maps existing object keys to new keys using a list of mapping rules. Each rule extracts a value via a JSONPath query and assigns it to a new key name.

Overview

The Key Mapping command provides functionality for:
  • Renaming object fields to match a target schema
  • Extracting nested values and promoting them to top-level keys
  • Applying consistent field naming across all objects in a collection

Command Type

Command Type ID: 1005

Parameters

ParameterTypeDescriptionRequired
mappingArray of KeyMappingDefines the rules for extracting data and mapping it to new keysYes

KeyMapping

FieldTypeDescriptionRequired
tostringThe new key to which the extracted value will be assignedYes
fromstringA JSONPath query string to extract the valueNo

Usage Examples

Rename Fields

{
  "command": "key-mapping",
  "params": {
    "mapping": [
      { "from": "$.eventId", "to": "id" },
      { "from": "$.eventName", "to": "name" },
      { "from": "$.startTime", "to": "startsAt" }
    ]
  }
}

Promote Nested Fields

{
  "command": "key-mapping",
  "params": {
    "mapping": [
      { "from": "$.event.id", "to": "eventId" },
      { "from": "$.event.sport.id", "to": "sportId" },
      { "from": "$.event.league.id", "to": "leagueId" }
    ]
  }
}

Map Without Source Path

{
  "command": "key-mapping",
  "params": {
    "mapping": [
      { "to": "payload" }
    ]
  }
}

Common Use Cases

  • Schema Normalization: Rename incoming fields to match your internal schema
  • Field Promotion: Lift nested values to the top level for easier access
  • Data Standardization: Apply consistent field naming across multiple data sources