Skip to content

Custom Operators

Fracttal ETL custom operators allow extending transformation capabilities beyond standard JSON Logic operators. These operators are specifically designed for common use cases in enterprise integrations.

Data Transformation Operators

rename

Renames fields and changes their data type.

{
  "transform": {
    "rename": [
      [{"var": "old_field"}, "new_field", "string"],
      [{"var": "birth_date"}, "fecha_nacimiento", "date"],
      [{"var": "price"}, "precio", "number"]
    ]
  }
}

Parameters: - field_path: Path to field to rename - new_name: New field name - data_type: New data type (string, number, date, boolean)

flatten

Flattens nested objects into a single level.

{
  "transform": {
    "flatten": {
      "data": {"var": "nested_object"},
      "separator": "_"
    }
  }
}

split_string

Splits string values into arrays.

{
  "transform": {
    "split_string": [
      {"var": "full_name"}, 
      " ",
      ["first_name", "last_name"]
    ]
  }
}

Date and Time Operators

format_date

Formats dates to specified formats.

{
  "transform": {
    "format_date": [
      {"var": "date_field"},
      "from_format",
      "to_format"
    ]
  }
}

add_days

Adds or subtracts days from a date.

{
  "transform": {
    "add_days": [
      {"var": "start_date"},
      30
    ]
  }
}

String Operators

clean_text

Cleans and normalizes text strings.

{
  "transform": {
    "clean_text": {
      "value": {"var": "text_field"},
      "trim": true,
      "lowercase": true,
      "remove_accents": true
    }
  }
}

extract_numbers

Extracts numeric values from strings.

{
  "transform": {
    "extract_numbers": {"var": "mixed_text"}
  }
}

Mathematical Operators

calculate

Performs mathematical calculations.

{
  "transform": {
    "calculate": {
      "operation": "percentage",
      "value": {"var": "amount"},
      "percentage": 15
    }
  }
}

round_number

Rounds numbers to specified decimal places.

{
  "transform": {
    "round_number": [
      {"var": "decimal_value"},
      2
    ]
  }
}

Array Operators

group_by

Groups array elements by a field.

{
  "transform": {
    "group_by": [
      {"var": "items"},
      "category"
    ]
  }
}

sort_array

Sorts arrays by specified criteria.

{
  "transform": {
    "sort_array": [
      {"var": "items"},
      "date",
      "desc"
    ]
  }
}

Validation Operators

validate_email

Validates email format.

{
  "transform": {
    "validate_email": {"var": "email_field"}
  }
}

validate_phone

Validates phone number format.

{
  "transform": {
    "validate_phone": [
      {"var": "phone_field"},
      "US"
    ]
  }
}

Best Practices

  1. Combine operators for complex transformations
  2. Use validation operators to ensure data quality
  3. Test transformations with sample data
  4. Document custom operator usage
  5. Handle errors gracefully with fallback values

Examples

Complete User Data Transformation

{
  "transform": {
    "rename": [
      [{"var": "user_name"}, "name", "string"],
      [{"var": "user_email"}, "email", "string"]
    ],
    "clean_text": {
      "value": {"var": "name"},
      "trim": true,
      "lowercase": false
    },
    "validate_email": {"var": "email"}
  }
}

Date Standardization

{
  "transform": {
    "format_date": [
      {"var": "created_at"},
      "MM/dd/yyyy",
      "yyyy-MM-dd"
    ],
    "add_days": [
      {"var": "created_at"},
      7
    ]
  }
}