Problem with Formatting data

Hey,

Im trying to convert response received from nocoDB to structure accepted by quickChart. Im trying to format data in javascript but Im getting nulls…

Please can you check if you see any issues? Thank you for help!

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:

Welcome to the community @bystry !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


I would advise using Set node instead. It is more straightforward. You do not need Code with custom scripting for that.

If you need to format date, you might want to use DateTime object from Luxon library. It’s very versatile and is more flexible than using standard Javascript Date object.

hello @bystry

the issue is that you have missed the json sub-property (e.g. instead of the data[i].date you will need to refer data[i].json.date)
the all() method will return item in the format

{
  "json": {
    "key": "value"
  }
}

but in the UI it shows as

{
    "key": "value"
}

or you can fix it by simply replacing the 6th line with
var data = $input.all().map(x => x.json)
then it will remove the hidden json property from the object

2 Likes

thank you all for help! specially you @barn4k !

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