Get the all components data from the current page to create the customized JSON | Community
Skip to main content
March 30, 2023
Solved

Get the all components data from the current page to create the customized JSON

  • March 30, 2023
  • 2 replies
  • 2142 views

I am working in one of the requirement where I need to create the page JSON form the all available components on the page . I tried to create the workflow process in the custom process I tried to get the all the current page's components but I am not able to get the all the component nodes and also not able to read the properties of the components.  I am not using SPA.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manisha_Mirchandani

Hi @anamikapatle ,

You can use sling model exporter functionality to export component properties into customized JSON

Refer -

1) https://medium.com/@toimrank/aem-sling-model-exporter-90dc872835b9
2) http://www.sgaemsolutions.com/2017/06/sling-model-exporter-in-aem-63.html

Thanks,
Manisha

 

 

2 replies

somen-sarkar
Community Advisor
Community Advisor
March 30, 2023

Hi,

OOTB AEM json exporter can deliver the content of any AEM page as json format.

eg:- localhost:4502/content/wknd/language-masters/en.model.json 

This may help in achieving the objective . Pls check the below link :-

https://experienceleague.adobe.com/docs/experience-manager-64/developing/components/json-exporter.html?lang=en

 

Thanks,

Somen

Manisha_Mirchandani
Manisha_MirchandaniAccepted solution
Level 2
March 30, 2023

Hi @anamikapatle ,

You can use sling model exporter functionality to export component properties into customized JSON

Refer -

1) https://medium.com/@toimrank/aem-sling-model-exporter-90dc872835b9
2) http://www.sgaemsolutions.com/2017/06/sling-model-exporter-in-aem-63.html

Thanks,
Manisha

 

 

March 30, 2023

Thanks @manisha_mirchandani  I have written the sling model exporter for all the components but I am not getting how will I use this model.tidy.json in my service or servlet class. I tried to write the http request but not getting any response from the model. 

Manisha_Mirchandani
Level 2
March 30, 2023

Hi @anamikapatle,

 

Can you please clarify the requirement?

As per understanding we use sling model exporter to export the data in the form of JSON to avoid writing servlet for the same.

 

 

Thanks,

Manisha