KV
Synopsis
Parses strings to extract key-value pairs into structured fields.
Schema
kv:
- field: <ident>
- field_split: <regex>
- value_split: <regex>
- description: <text>
- exclude_keys: <string[]>
- if: <script>
- ignore_casting: <boolean>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- include_keys: <string[]>
- lowercase_keys: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- prefix: <string>
- strip_brackets: <boolean>
- tag: <string>
- target_field: <ident>
- trim_key: <char[]>
- trim_value: <char[]>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Source field containing key-value pairs |
field_split | Y | - | Delimiter between key-value pairs |
value_split | Y | - | Delimiter between keys and values |
description | N | - | Documentation note |
exclude_keys | N | - | Keys to exclude from output |
if | N | - | Conditional expression |
ignore_casting | N | false | Disable automatic type conversion |
ignore_failure | N | false | Skip processing errors |
ignore_missing | N | false | Skip if input field missing |
include_keys | N | - | Only include specified keys |
lowercase_keys | N | false | Convert all keys to lowercase |
on_failure | N | - | Error handling processors |
on_success | N | - | Success handling processors |
prefix | N | - | Prefix for extracted keys |
strip_brackets | N | false | Remove brackets from values |
tag | N | - | Identifier for logging |
target_field | N | - | Output field for parsed data |
trim_key | N | - | Characters to trim from keys |
trim_value | N | - | Characters to trim from values |
Details
The processor supports various delimiter patterns, key filtering, value formatting, and automatic type casting.
note
Whitespace around field and value delimiters is automatically trimmed.
warning
Malformed inputs may result in missing entries or incomplete parsing.
Examples
Basic
Parsing semicolon-separated pairs... |
|
extracts the structured fields: |
|
Target Field
Storing the parsed values in a separate object... |
|
groups related fields: |
|
Keys
Including only specific keys... |
|
extracts only those records: |
|
Formatting
Cleaning up and formatting values... |
|
standardizes the output: |
|
Prefixing
Adding a prefix to the extracted keys... |
|
places the fields in a namespace: |
|