Skip to main content
The Key Mapping With JSONPath command (Command Type: 1012) extracts specific values from an object using JSONPath queries and maps them to new keys. It is similar to Key Mapping but applies the extraction across the entire data structure using JSONPath.

Overview

The Key Mapping With JSONPath command provides functionality for:
  • Extracting values from deeply nested structures using JSONPath
  • Mapping extracted values to new top-level keys
  • Transforming complex objects into flat, normalized structures

Command Type

Command Type ID: 1012

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

Extract and Rename Nested Fields

{
  "command": "key-mapping-with-json-path",
  "params": {
    "mapping": [
      { "from": "$.data.event.id", "to": "eventId" },
      { "from": "$.data.event.name", "to": "eventName" },
      { "from": "$.data.market.id", "to": "marketId" }
    ]
  }
}

Flatten a Deep Hierarchy

{
  "command": "key-mapping-with-json-path",
  "params": {
    "mapping": [
      { "from": "$.response.body.items[0].id", "to": "firstItemId" },
      { "from": "$.response.meta.total", "to": "totalCount" }
    ]
  }
}

Common Use Cases

  • Deep Extraction: Pull values out of deeply nested JSON paths
  • Flat Output: Produce flat objects from hierarchical input for sink commands
  • Schema Mapping: Map arbitrary incoming structures to a fixed output schema
  • Key Mapping - Simpler field renaming without deep path queries
  • Json Path - Extract arrays or multiple values via JSONPath
  • Object Mapper - Full object transformation