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

JSON output for a page with different components

Avatar

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
rajareddych
Level 2

06-11-2018

Could you please help me in writing Sling Model for generating custom JSON for

1. Component with parsys (components can be added in parsys)

2. Page level (with all the components and sub-components added)

Any code example would help a lot.

Thanks

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

06-11-2018

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

06-11-2018

You can also export Sling Resources to JSON using Java logic as discussed here -- Converting AEM/Sling Resources to JSON - Adobe Experience Manager | AEM/CQ | Apache Sling

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

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

06-11-2018

Avatar

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
rajareddych
Level 2

27-11-2018

I appreciate the help guys. I could not relate the concepts present at links provided to my requirement.

It would be nice to have a code preview for point 1 or 2.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

27-11-2018

Sling Exporter returns data for a component in parsys - as you requested for point 1 (Component with parsys).

Avatar

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
rajareddych
Level 2

27-11-2018

Thanks Donald,

My requirement is, export JSON for

page with contentParsys [allow only 1 component with componentsParsys],

componentsParsys allow multiple components [components without parsys & components with answerParsys] multiple times,

answerParsys allow only multiple Answer components.

The complexity of this requirement is confusing me.

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

471 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

471 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

28-11-2018

Raja,

  Could you please elaborate on exactly how you need the output ? Its bit confusing with all the info what you gave.

Thanks

Veena

Avatar

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rajareddych
Level 2

Likes

0 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
rajareddych
Level 2

28-11-2018

Created a Page using Template having pathParsys,

          pathParsys allow component A multiple times.

          Component A has componentParsys,

          componentParsys allow component B, component C, component D, component  E, component F, component G, component H multiple times.

          Component C & Component D are configured with 1 default Answer component and have answerParsys (to add additional answer components),

          answerParsys allow Answer component multiple times.

          Component H is configured with 2 default Answer components

Note: Component  B, Component  E, Component F, Component G does not have parsys.

After a lot of combinations of components are added to the Page and Published, I need to generate JSON at Page level (with all components data).

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

471 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

471 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

29-11-2018

With the approach what scott mentioned what is the JSON you are getting right now ? With some real data I can give you a solution though