Filter to SQL
AI-generatedSummary
Builds a SQL WHERE fragment from the supplied JSON filter conditions, with values escaped and embedded in the SQL string. Use the returned whereClause in a downstream query, for example as {{ $json.whereClause }}.
Inputs
- Filter (JSON) (`filterJson`) — A JSON array of conditions with
field,operator, andvalue. Operators are==,!=,>,<,between(two-element value array), andin(value array). Conditions are joined withAND. An optionaldate_limitadds an inclusive date range, usingmode(relative,after,before, orrange), optionaldays/hoursorstart/end, and optionalcolumn; the column defaults tofield. Safe SQL identifier names are required for fields. Invalid JSON, non-array input, and unrecognized rows are ignored; the default is[]`.
Output shape
A single n8n item containing whereClause, a SQL string; it is empty when no valid conditions produce clauses.
The operation returns no separate query-parameters array. Values are embedded as escaped SQL literals, with dates reduced to YYYY-MM-DD. Date limits use the current time when bounds are omitted.