When working with arrays in Code actions, you may encounter two common challenges:Documentation Index
Fetch the complete documentation index at: https://docs.twenty.com/llms.txt
Use this file to discover all available pages before exploring further.
- Arrays passed as strings — data from external systems or previous steps arrives as a string instead of an actual array
- Can’t select individual items — you can only select the entire array, not specific fields within it
Parsing Arrays from Strings
Arrays are often passed between workflow steps as strings or JSON rather than native arrays. This happens when:- Receiving data from external APIs via HTTP Request
- Processing webhook payloads
- Passing data between workflow steps
typeof users === "string" ? JSON.parse(users) : users checks if the input is a string, parses it if needed, or uses it directly if it’s already an array.
Extracting Individual Fields from Arrays
A webhook might return an array likeanswers: [...], but in subsequent workflow steps you can only select the entire array — not individual items within it.
Solution: Add a Code node to extract specific fields and return them as a structured object:
answer.firstname and answer.name from the variable picker.
We’re actively working on making array handling easier in future updates.