Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

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

Avatar

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

http://keysandstrokes.info/aem-code-snippets-export-page-data-as-json-format-using-sling-model-expor...

3 Replies

Avatar

Administrator

Really valuable content!!

~kautuk



Kautuk Sahni

Avatar

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?