Join KV
Synopsis
Converts a map of key-value pairs to a formatted string.
Schema
- join_kv:
field: <ident>
target_field: <ident>
separator: <string>
kv_separator: <string>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Source field containing the map of key-value pairs |
target_field | Y | - | Destination field to store the resulting string |
separator | N | ; | Character(s) used to separate key-value pairs |
kv_separator | N | = | Character(s) used to separate keys from values |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if conversion fails |
ignore_missing | N | false | Skip if source field doesn't exist |
on_failure | N | - | Error handling processors |
on_success | N | - | Success handling processors |
tag | N | - | Identifier |
Details
Converts a map (object) of key-value pairs into a single formatted string. The processor joins all key-value pairs from the source map using specified separators, creating a consistent string representation of the structured data.
Keys in the resulting string are always sorted alphabetically to ensure consistent output regardless of the original map order. This makes the output deterministic, which is important for scenarios like generating hash values or signatures from the string.
The processor sorts keys alphabetically to ensure consistent output ordering, which is useful for creating deterministic string representations of maps for logging, display, or further processing.
When converting complex nested objects, only the string representation of the value is included. Nested objects will be formatted using their default string representation, which may not be ideal in all cases. For complex nested structures, consider flattening the data first.
Examples
Basic
Converting map to string using default separators... |
|
creates a string with default separators: |
|
Custom
Using custom field and pair separators... |
|
formats headers in HTTP style: |
|
URL Queries
Creating a URL query string format... |
|
builds a properly formatted query string: |
|
Field Tags
Formatting a map with XML-style tags... |
|
with additional processing: |
|