Code Node (Python) list/array output bug

Describe the problem/error/question

In Code Node, when I’m writing in Python and adding a new list field to _json, I get a {"$$flags": 31} content instead.

Please share your workflow

Share the output returned by the last node

[
  {
    "array": {
      "$$flags": 31
    }
  }
]

Information on your n8n setup

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

Hi @leshchenko

The Python in the code node is still under Beta. Unfortunately, this means some bugs are expected. The "$$flags": 31 output is due to an incorrect interpretation of json. You can work-around this by importing the json library and encode the Python object correctly in the node.

So this should work:

import json
_json.array = json.dumps([])

See also here for a similar topic: