Array in JSON from Notion DB items

Hi everyone,

I have tried to do the following for a while now but I can’t find the answer, help!

  1. get database items from the Notion “Search objects” module (this is working)
  2. extract a specific field from these items (several items are returned), which is the url to a file
  3. create a json and use it as an input to an API call

This JSON must be:

{
  "urls": [
    "https://fileserver.com/a1.pdf",
    "https://fileserver.com/b2.pdf"
  ],
  "export_type": "json",
  "expiration": 0,
  "cloud_storage": 1
}

My issue is with point 2.
I need to create an array of these urls, so that I can use it properly in my json.
But when I use the Aggregate JSON module, I get the following result:

[
  {
    "urls": [
      "https://fileserver.com/a1.pdf"
    ],
    "expiration": 0,
    "export_type": "json",
    "cloud_storage": 1
  },
  {
    "urls": [
      "https://fileserver.com/a2.pdf"
    ],
    "expiration": 0,
    "export_type": "json",
    "cloud_storage": 1
  }
]

I hope you can help!
Thanks!
Julien

Hi. Try use the Map functions to build an array only with the objects do you want. And later try use the Flatten function to let all urls in the same array level.

Here is the doc for Array functions:

https://www.make.com/en/help/functions/array-functions


Thanks, Helio!
Wemakefuture
If you have questions reach out :wink:

1 Like