Merge values from multiple Arrays and Bundles

Hello,
I work with Notion where a page content is an array of multiple blocks.

This is the output I get:

[
    {
        "object": "block",
        "id": "3209dc63-2dbd-475a-bad6-7cadce636994",
        "parent": {
            "type": "page_id",
            "page_id": "184f6a9e-5cc3-44c0-ae1d-2460d658b82b"
        },
        "created_time": "2023-12-13T07:18:00.000Z",
        "last_edited_time": "2023-12-13T07:18:00.000Z",
        "created_by": {
            "object": "user",
            "id": "7efbecbd-cb46-4d65-8b89-9202e3ebd39b"
        },
        "last_edited_by": {
            "object": "user",
            "id": "7efbecbd-cb46-4d65-8b89-9202e3ebd39b"
        },
        "has_children": false,
        "archived": false,
        "type": "paragraph",
        "paragraph": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {
                        "content": "Article content 2 lorem impsum bla bla bla",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Article content 2 lorem impsum bla bla bla",
                    "href": null
                }
            ],
            "color": "default"
        },
        "__IMTLENGTH__": 3,
        "__IMTINDEX__": 1
    },
    {
        "object": "block",
        "id": "06ec6c19-9799-46b1-8df2-98a687f7c34f",
        "parent": {
            "type": "page_id",
            "page_id": "184f6a9e-5cc3-44c0-ae1d-2460d658b82b"
        },
        "created_time": "2023-12-13T07:19:00.000Z",
        "last_edited_time": "2023-12-13T07:19:00.000Z",
        "created_by": {
            "object": "user",
            "id": "7efbecbd-cb46-4d65-8b89-9202e3ebd39b"
        },
        "last_edited_by": {
            "object": "user",
            "id": "7efbecbd-cb46-4d65-8b89-9202e3ebd39b"
        },
        "has_children": false,
        "archived": false,
        "type": "paragraph",
        "paragraph": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {
                        "content": "Paragraph 2 bla bla bla",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Paragraph 2 bla bla bla",
                    "href": null
                }
            ],
            "color": "default"
        },
        "__IMTLENGTH__": 3,
        "__IMTINDEX__": 2
    },
    {
        "object": "block",
        "id": "66530c16-abf8-41bd-bc46-370ecb84ab90",
        "parent": {
            "type": "page_id",
            "page_id": "184f6a9e-5cc3-44c0-ae1d-2460d658b82b"
        },
        "created_time": "2023-12-13T07:18:00.000Z",
        "last_edited_time": "2023-12-13T07:18:00.000Z",
        "created_by": {
            "object": "user",
            "id": "7efbecbd-cb46-4d65-8b89-9202e3ebd39b"
        },
        "last_edited_by": {
            "object": "user",
            "id": "7efbecbd-cb46-4d65-8b89-9202e3ebd39b"
        },
        "has_children": false,
        "archived": false,
        "type": "paragraph",
        "paragraph": {
            "rich_text": [],
            "color": "default"
        },
        "__IMTLENGTH__": 3,
        "__IMTINDEX__": 3
    }
]

I need to concatenate, or merge, or connect together all paragraphs into one article. So I need to work only with plain_text (or content, there are the same).
I tried everything, I cant put them together…
Could you please help me somehow?

Welcome to the Make community!

You can use a Text Aggregator with the following:

{{ join(map(18.paragraph.rich_text; "plain_text"); newline) }}

Output

Screenshot_2023-12-13_161246

3 Likes

Thank you very much for your effort.

I tried it, but there was not “JSON - Parse JSON” option, because there was not such a module, so I added it, an set like this:

“notion list page contents” data structure I created by copying OUTPUT bundle from here:


and then clicked “generate”:

But still nothing - I get an error “Source is not valid JSON”:

So now I am frozen here:

No, replace the Parse JSON module with your module [18]. The Parse JSON module is to emulate the output bundles that you provided from module [18].

3 Likes

samliew thank you very much! This works 100%!

2 Likes

Well, I am in troubles with the same issue when trying to join multiple page content types. In full article there are not only paragraphs, but also heading_3, bulleted_list_item…
article_output.json (58.3 KB)

How to create one text with Headings, bulleted points and paragraphs in correct order? I tried to combine multiple map in join, but no success.

Heya @Vladimir_Gabor :wave:

I just wanted to offer a friendly piece of advice to you. The more effective approach is to create a new topic for each one of your questions rather than continue in an old thread. If you start a new conversation you are more likely to get help from one of our users. :smiling_face:

Thank you very much for understanding and keeping our community neat and tidy for others. We appreciate it :pray:

1 Like