Expand my Community achievements bar.

SOLVED

JSON:API Exporter

Avatar

Level 2

Hi,

I would like to know if there are any open source JSON:API sling exporters available in AEM to export the content to SPA 

in JSON:API format(https://jsonapi.org/) , if it is not available i am looking forward to any available solutions which is available

I could see similar offering is available in drupal (https://www.drupal.org/project/jsonapi)

 

Thanks

 

 

 

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
Apache Sling provides a Jackson JSON exporter to satisfy common cases of exporting Sling Models as JSON objects for consumption by SPAs.
 

 

import com.fasterxml.jackson

 

You can utilise the AEM WCM Core V2 Page Component for page creation, where when you include the selector of "model" and extension of "json", you will get a JSON representation of the page. There's no magic happening with the WCM Core V2 Page Component. It simply returns a JSON representation of all the components that exist on the page, formatted. Each component, however, must have a 1 to 1 relationship with a Sling Model, and the sling model must be programmatically configured with the Jackson JSON exporter. 
 
AEM WCM Core V2 Components are all implemented with Sling Models and Jackson Exporters, so if you would like to test this feature, you can simply create a new page using the WCM Core V2 Page Component, next you can start constructing the page with the WCM Core V2 Components. Next, visit the webpage via /content/my-site/page.model.json, and you will get a JSON representation of the entire page, ready for consumption by SPAs.
 
A good article here is:
 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor
Apache Sling provides a Jackson JSON exporter to satisfy common cases of exporting Sling Models as JSON objects for consumption by SPAs.
 

 

import com.fasterxml.jackson

 

You can utilise the AEM WCM Core V2 Page Component for page creation, where when you include the selector of "model" and extension of "json", you will get a JSON representation of the page. There's no magic happening with the WCM Core V2 Page Component. It simply returns a JSON representation of all the components that exist on the page, formatted. Each component, however, must have a 1 to 1 relationship with a Sling Model, and the sling model must be programmatically configured with the Jackson JSON exporter. 
 
AEM WCM Core V2 Components are all implemented with Sling Models and Jackson Exporters, so if you would like to test this feature, you can simply create a new page using the WCM Core V2 Page Component, next you can start constructing the page with the WCM Core V2 Components. Next, visit the webpage via /content/my-site/page.model.json, and you will get a JSON representation of the entire page, ready for consumption by SPAs.
 
A good article here is: