How to create/expose JSON from Navigation Component? | Community
Skip to main content
saurabhn3378167
New Participant
Nov 1, 2019 7:40 AM UTC
Solved

How to create/expose JSON from Navigation Component?

Is there any way by using sling model/exporter we can expose Navigation menu items in JSON/HTML/XML format.

Since Navigation component has only one field to author i.e. root page property and it populates all sub tree so only root path get stored on jcr:content. and we try model.json we get only root page path property in it. How to get all the tree values in json?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Ankur_Khare
Ankur_KhareAccepted solution
New Participant
Nov 1, 2019 9:39 AM UTC

Create a custom sling model exporter  -

Develop Sling Model Exporters

And populate the child nodes as u do it in navigation component >>>> iterate over the child nodes.

3 replies

arunpatidar
New Participant
Nov 5, 2019 5:55 PM UTC
saurabhn3378167
New Participant
Nov 5, 2019 6:03 AM UTC

Thank you but how to create xml using sling model.

Since for json it provides jackson, is there anything for xml ?

Translate
Ankur_Khare
Ankur_KhareAccepted solution
New Participant
Nov 1, 2019 9:39 AM UTC

Create a custom sling model exporter  -

Develop Sling Model Exporters

And populate the child nodes as u do it in navigation component >>>> iterate over the child nodes.

Translate