Rendering JSON for an AEM resource

Avatar

Avatar

Lavanya_Malyala

Avatar

Lavanya_Malyala

Lavanya_Malyala

14-06-2018

Hi,

I'm trying to convert an AEM page (/content/myproject/en) to JSON. I had followed the below link and I could get the expected JSON:

Converting AEM/Sling Resources to JSON - Adobe Experience Manager | AEM/CQ | Apache Sling

However, from the following link I see that we can retrieve the HTML markup (or JSON, XML, txt, PDF, etc...) for a component as well as a page if we provide the correct path. When I tried implementing the same I'm getting the JSON, but not a complete one. I mean that I'm getting a partial JSON which is an invalid one.

FYI: The below link works perfectly for html

Get the rendered HTML for an AEM resource, component or page - Adobe Experience Manager | AEM/CQ | A...

I wonder if the second link is valid for my use case (getting JSON) or not. Can anyone let me know if you had used SlingRequestProcessor service for retrieving JSON?

I'd really appreciate any help or advice on this!

Thanks,

Lavanya Malyala

Replies

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

859

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

859
Arun_Patidar
MVP

14-06-2018

Hi,

You should use Sling Model Exporter, which is enhanced Sling Model using the Exporter framework to rendition as JSON and allow to customise output as well.

Adobe Experience Manager Help | Developing Sling Model Exporters in AEM

Thanks

Arun

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

991

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

991

Correct Reply

1.0K
Jörg_Hoh
Employee

14-06-2018

What do you mean with "I get JSON, but not a complete one"?