Skip to main content

Switch Node

Routes by comparing one evaluated value against ordered cases.

Config shape (code-grounded)

  • config.value_expression: expression used to compute value
  • config.cases: array of { value, output }
  • config.default_output: optional fallback (defaults to default)

Example usage snippet

{
"id": "n_switch",
"type": "switch_node",
"config": {
"value_expression": "{{ $json['http_trigger'].request.method }}",
"cases": [
{ "value": "GET", "output": "read" },
{ "value": "POST", "output": "write" }
],
"default_output": "unsupported"
}
}

Output behavior

  • Returns matched_output equal to the first matching case output.
  • Uses string comparison (fmt.Sprint) internally.
  • Falls back to default_output when no case matches.

Common pitfalls

  • Case mismatch due to whitespace or letter casing.
  • Missing default_output edge and dropping unexpected values.
  • Using switch for complex predicates better handled by condition_node.