Python code

latest selfhosted version

hi, i am trying my first python node but not sure how to work with arrays . have simlpe code.
but i get this output. no idea what is $$flags

{
“google_product_category/__text”: “Apparel & Accessories > Jewelry > Watches”,
“cats”: { “$$flags”: 31}
},


from html import unescape


categ = unescape(_input.item.json["google_product_category/__text"])
acateg = categ.split('>')
_input.item.json.cats = acateg
return _input.item

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:

Hi @Edmunds_Priede, I am sorry you are having trouble.

I think this is related to the datatype returned by the split method method in your line 5. While we should probably auto-convert such structures at some point when possible, keep in mind the Python implementation is still in a beta stage.

So for the time being you can first import json and then use acats = json.dumps(cats.split('>')) instead of acats = cats.split('>') to avoid this problem. json.dumps will return a JSON string representation of the Python list returned by your the split method, which n8n can understand.

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