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
BedrockMission!

Learn More

View all

Sign in to view all badges

Expose whole page and its components as json

Avatar

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

216 likes

Total Posts

272 posts

Correct Reply

65 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

216 likes

Total Posts

272 posts

Correct Reply

65 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile
Shashi_Mulugu
MVP

05-11-2019

Hello arunpatidar26​, kautuksahni​, Do you have any suggestions over generating whole page and its associated components as json. We are using sling model exporters, and using .model.json for getting the json out of a resourcetype, but wanted to know what we can do if we want to expose whole properties and components.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

22-11-2019

Yes, you can try. but make sure you exclude properties before getting a Model from the resource.(Setting exclude property value to null can help)

Answers (2)

Answers (2)

Avatar

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

216 likes

Total Posts

272 posts

Correct Reply

65 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

216 likes

Total Posts

272 posts

Correct Reply

65 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile
Shashi_Mulugu
MVP

22-11-2019

Hello Arun,

Need your inputs, I have went through your custom implementation, can't we use something as below to iterate to child resource and inject its own models and adapt to json instead of manually transforming node to json, maintaining custom ignore properties and all?

Resource resource = resourceResolver.getResource("/mysite/component/breadcrumb");
slingScriptHelper.getService(ModelFactory.class).getModelFromResource(resource);

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

05-11-2019

you need to write custom implementation

example - AEM - Get JSON response of an AEM Page