Remove html tag in string

Hello, I am looking to delete html tags in a string

Exemple :

This is the response from Wordpress’s JSON API

Thanks for help

You might want to use a function node with string replace.

Alternatively can you also try to do that with the HTML Extract node:

{
  "nodes": [
    {
      "parameters": {
        "extractionValues": {
          "values": [
            {
              "key": "key",
              "cssSelector": ":root"
            }
          ]
        },
        "options": {}
      },
      "name": "HTML Extract",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        1000,
        350
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "data",
              "value": "={{$json[\"content\"][\"rendered\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        800,
        350
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      content: {\n        rendered: '<p>Some text <a href=\"a\">test link</a></p>'\n      }\n    }\n  }\n];"
      },
      "name": "Mock Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        600,
        350
      ]
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "HTML Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mock Data": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
2 Likes