Skip to main content

Kebab Case

Text Processing String Manipulation

Synopsis

Converts strings to kebab-case format.

Schema

- kebabcase:
field: <ident>
target_field: <ident>
fields: <array>
exclude: <array>
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:

FieldRequiredDefaultDescription
fieldN-Selects value mode: converts the value of this field to kebab-case. The value must be a string or an array of strings. Mutually exclusive with fields — when field is set, fields and exclude are ignored
target_fieldNSame as fieldWhere the converted value is written in value mode. Ignored in name mode
fieldsN["*"]Selects name mode: glob patterns matching field names to rename to kebab-case. The values are left untouched. a.* renames the keys inside object a, *.* those of every root object. Omitting both field and fields renames every root-level field name; names beginning with _ are never renamed
excludeN-Field names to leave alone in name mode. Has no effect in value mode
descriptionN-Explanatory note
ifN-Condition to run
ignore_failureNfalseContinue processing if conversion fails
ignore_missingNfalseSkip processing if referenced field doesn't exist
on_failureN-See Handling Failures
on_successN-See Handling Success
tagN-Identifier
disabledNfalseWhen true, the processor is skipped and the event continues to the next one. Lets you take a processor out of the path without removing its configuration

Details

Converts string values to kebab-case format by replacing spaces, underscores, dots, and other separators with hyphens, then converting all characters to lowercase. This format is commonly used in URLs, CSS classes, file names, and command-line parameters.

The processor handles various input formats and normalizes them to the consistent kebab-case style with lowercase letters separated by hyphens.

note

kebab-case format uses hyphens as separators and converts all text to lowercase, resulting in format like "user-name", "api-response-data", or "system-config-value". It's called kebab-case because the hyphens look like skewers.

The processor preserves the logical word boundaries from the input while standardizing the format for consistent usage in web development and system naming.

warning

Consecutive separators in the input may result in multiple consecutive hyphens in the output. The processor does not automatically clean up redundant separators.

Examples

Basic Conversion

Converting field to kebab-case format...

{
"component_name": "UserAccountSettings"
}
- kebabcase:
field: component_name
target_field: kebab_name

converts to kebab-case:

{
"component_name": "UserAccountSettings",
"kebab_name": "user-account-settings"
}

URL Slug Generation

Creating URL-friendly slug from title...

{
"page_title": "Getting Started with DataStream"
}
- kebabcase:
field: page_title
target_field: url_slug

creates URL-friendly identifier:

{
"page_title": "Getting Started with DataStream",
"url_slug": "getting-started-with-datastream"
}

Mixed Format Input

Normalizing mixed separators to kebab-case...

{
"field_name": "api_response.data_with spaces"
}
- kebabcase:
field: field_name

standardizes all separators to hyphens:

{
"field_name": "api-response-data-with-spaces"
}

Multiple Fields

Renaming field names to kebab-case, leaving values untouched...

{
"css_class": "MainNavigation",
"element_id": "user_profile_section",
"data_attribute": "click.handler.name"
}
- kebabcase:
fields: ["css_class", "element_id", "data_attribute"]

renames the matched names; the values are unchanged:

{
"css-class": "MainNavigation",
"element-id": "user_profile_section",
"data-attribute": "click.handler.name"
}