Filter Single Item JSON Array?


I use a HTML (extract HTML Content) node to filter a webpage and extract text for a specific class.
As output I get a (single item) JSON array like this :

    "data": [
      "AAA BBB CCC",
      "AAA AA DDD",    <<< to keep
      "BBBB CCC",
      "AAAAA EE",
      "BBB FF",
      "C JJJ",
      "GG HHHHHHH",
      "II AAA AA HHH"   <<< to keep

My goal is to filter items of this JSON array in order to keep those who match a pattern (eg AAA AA).

I tried the filter node (eg {{ $ }} contains "AAA AA" and code nodes without success.
I reviewed forums and tutorials without success either.
I’ve seen examples to iterate over multiple items but not for a single item array/list.

Does anyone have an example to achieve this ?

n8n Version : 1.31.2
Database : SQLite
Running on: Docker
O.S. : Linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Sampling0990

Is that what you asked for?

1 Like

Hello @barn4k,
Exactly. Thanks a lot for this !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.