Skip to main content
Version: 1.3.0

Snake Case

Text Processing String Manipulation

Synopsis

Converts strings to snake_case format.

Schema

- snakecase:
field: <ident>
target_field: <string>
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-Single field to convert to snake_case
target_fieldNSame as fieldTarget field to store snake_case result
fieldsN-Array of fields to convert to snake_case
excludeN-Array of fields to exclude from conversion
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

Details

Converts string values to snake_case format by replacing spaces, hyphens, dots, and other separators with underscores, then converting all characters to lowercase. This format is commonly used in programming languages like Python, Ruby, and database naming conventions.

The processor handles various input formats including camelCase, PascalCase, kebab-case, and space-separated words, normalizing them to the consistent snake_case style.

note

snake_case format uses underscores as separators and converts all text to lowercase, resulting in format like "user_name", "api_response_data", or "system_config_value". It's widely used in Python and database schemas.

The processor preserves the logical word boundaries from the input while standardizing the format for consistent usage in code and data storage.

warning

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

Examples

Basic Conversion

Converting camelCase to snake_case...

{
"fieldName": "userAccountSettings"
}
- snakecase:
field: fieldName
target_field: snake_name

converts to snake_case:

{
"fieldName": "userAccountSettings",
"snake_name": "user_account_settings"
}

Database Column Names

Creating database-friendly column names...

{
"columnTitle": "Customer Email Address"
}
- snakecase:
field: columnTitle
target_field: column_name

generates database column name:

{
"columnTitle": "Customer Email Address",
"column_name": "customer_email_address"
}

Mixed Format Input

Normalizing mixed separators to snake_case...

{
"variableName": "api-response.data with spaces"
}
- snakecase:
field: variableName

standardizes all separators:

{
"variableName": "api_response_data_with_spaces"
}

Multiple Fields

Converting multiple fields to snake_case...

{
"firstName": "John Doe",
"lastName": "Smith Williams",
"emailAddress": "[email protected]"
}
- snakecase:
fields: ["firstName", "lastName", "emailAddress"]

processes all specified fields:

{
"firstName": "john_doe",
"lastName": "smith_williams",
"emailAddress": "john_doe@example_com"
}

Configuration Keys

Creating configuration key names...

{
"settingName": "Maximum Connection Timeout"
}
- snakecase:
field: settingName
target_field: config_key

generates configuration key:

{
"settingName": "Maximum Connection Timeout",
"config_key": "maximum_connection_timeout"
}