Why does it say "object" in JSON data

Hi guys

I am completly new, but been struggeling for so long to get the data from my two Dataset that is called “unmatched” and “alldata”

in this case I try to pick up the lines “beløb” Kontonummer" and “navn” (amount, account number and name in english)

I want to get all the rows:

Hi Fred,
This is because you’re trying to insert a list of JSON objects directly into text — and n8n doesn’t automatically turn that into something human-readable.

If you just want to show the full data (all rows), you can turn it into a string like this:
{{ JSON.stringify($json.unmatched, null, 2) }}

This will convert the list of rows into readable text

or you if If you want to format it nicely, try:
{{ $json.unmatched.map(x => Navn: ${x["[\"navn\"]"]}, Konto: ${x["[\"Konto nummer\"]"]}, Beløb: ${x["[\"beløb\"]"]}).join(‘\n’) }}

You will get an out put like:

Navn: Overført resultat fra tidligere år, Konto: 4700, Beløb: 52391.45
Navn: Regulering udskudt skat, Konto: 4970, Beløb: 5000

Hope this helps mate

1 Like

simply add .toJsonString function inside javascript expression, for your case it will like this:
{{ $json.unmatched.toJsonString() }}

1 Like

Thanky you guys!

Another question is, why does it show like this in the output and no longer as in the input?

I am trying to get it structures nicely but as you can see I am new coder.

I want it to be structured like this:
Account ID: 61020
Description: Regulering udskudt skat
Amount: 5000

Account ID: 51000
Description: Drivhus og telt primo
Amount: 52294

This is my current code:
const input = $input.all();
const output = input[0].json.output;

const formatted = output.map(item => {
return Account ID: ${item.accountId} Description: ${item.description} Amount: ${item.amount};
});

return [{
json: {
result: formatted.join(“\n\n”)
}
}];

That’s already structured, as you can see in the result, it has \n for every data break, and \n\n for every section break.
the \n mean creating new line, you can try it either with chat node or something else

1 Like

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