Switch Node
Routes by comparing one evaluated value against ordered cases.
Config shape (code-grounded)
config.value_expression: expression used to compute valueconfig.cases: array of{ value, output }config.default_output: optional fallback (defaults todefault)
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_outputequal to the first matching caseoutput. - Uses string comparison (
fmt.Sprint) internally. - Falls back to
default_outputwhen no case matches.
Common pitfalls
- Case mismatch due to whitespace or letter casing.
- Missing
default_outputedge and dropping unexpected values. - Using switch for complex predicates better handled by
condition_node.