That happens because {{ $json.data }} is an array/object in your case, and you can’t concatenate strings with objects directly, You’ll need to convert it into a string first..
You can do this by wrapping it in JSON.stringify() (or .toJsonString()):
You’re very close. The issue is how n8n renders values inside Prompt fields.
Text you type is literal.
Anything inside {{ ... }} is one expression that must evaluate to a string.
If you insert an object/array directly, it will show as [object Object]. You need to stringify or format it.
So instead of:
some string +{{ $json.data }}
use one of these:
1) Quick and simple (stringify the whole array)
some string {{ JSON.stringify($json.data) }}
2) Nicely formatted list
Here are the results:
{{ $json.data.map(x => `${x.name} (score: ${x.score})`).join('\n') }}
3) Everything inside one expression (also fine)
{{ 'some string ' + JSON.stringify($json.data) }}
Tip: keep the +inside the {{ ... }} (or don’t use it at all — plain text + {{ expression }} works) and make sure your expression returns a string.
To build a prompt that mixes static text and data from a previous node you need to remember two things about n8n expressions:
Everything inside double‑curly braces ({{ … }}) is evaluated as JavaScript. Anything outside is sent as plain text.
Objects and arrays are not automatically formatted; if you insert an object directly you’ll see [Object object] or similar. To show data you must convert it to a string or iterate over it.
Here’s how you can achieve what you want:
Convert the array to a JSON string – this is the simplest way to show the array contents. Use JSON.stringify() inside the expression:
Here is the data: {{ JSON.stringify($json.data) }}
The n8n docs note that some nodes expect stringified JSON rather than objects: community.n8n.io, and using JSON.stringify() solves this.
Format the array nicely – if you only want specific fields (e.g. name and score), map over the array and join the results:
Concatenate static text and dynamic data inside the expression – if you prefer to add a prefix on the same line, keep the concatenation inside the braces:
{{ 'Scores ➜ ' + JSON.stringify($json.data) }}
Placing the plus sign inside the braces ensures the expression is evaluated. Writing Some text + {{ $json.data }} outside of the braces will not work because only the part in {{ … }} is evaluated.
Using these patterns you can build complex prompts that include both static text and dynamic data from previous nodes.