Skip to main content
saurabhn3378167
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
Community Advisor
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.

Ankur

3 replies

Ankur_Khare
Community Advisor
Ankur_KhareCommunity AdvisorAccepted solution
Community Advisor
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
Ankur
saurabhn3378167
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
arunpatidar
Community Advisor
Community Advisor
Nov 5, 2019 5:55 PM UTC