Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

How to create JSON for list of Content Fragments?

Avatar

Level 4

Hi Team,

I have a requirement where I need to generate the single JSON data of all the content fragments selected. In component dialog Author is selecting the folder & via Sling Model I'm able to get all the content fragments within selected folder. Then I'm adding to those in list<resource> & can use on page as well.

But now I want to generate one JSON file with all the data from these fragments (something like below snippet) & each fragment may include more than 20 fields.

{
    "cfList": [
        {
            "id": "1",
            "firstName": "A",
            "lastName": "B"
        },
        {
            "id": "2",
            "firstName": "C",
            "lastName": "D"
        },
        {
            "id": "3",
            "firstName": "E",
            "lastName": "F"
        }
    ]
}

Can you please suggest any approach to achieve this?

Many thanks,

sesmic

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 4

Hi @sesmic ,

By default content fragment are exposed as json and we can also use GraphQL for selected cf

Hope you had a look https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-get-data-from-conte...

 

Thanks