Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM code snippets : export page data as json format using sling model exporter


Level 1

In my previous article’s you have seen how to export page data as a JSON format using servlet, now, I am going to explain exporting page content as JSON using sling models exporter,  using sling model exporter you can get below advantages

  • No need to write servlet to export data as JSON format
  • You can use same code which is written using sling models to render content and to export as JSON format

Sling model exporter is very useful when you want to publish your data to third party system’s or consuming within the site using ajax request if you have sling models and wants to serialize them,  by providing simple @Exporter annotations to the existing sling models you can convert your model to CaaS based URL

Refer below link to get to access to complete article and to download code

0 Replies


Level 2

Hi Raj,

I have the similar requirement.

I have a site with several pages and each page has 1 or more content fragments on it + some other components.

Now when i request the page as model.json, I want to hide/remove the unwanted data from my json. How can i achieve this?

Can you please guide me on this?