How to create/expose JSON from Navigation Component? | Community
Skip to main content
saurabhn3378167
November 1, 2019
Solved

How to create/expose JSON from Navigation Component?

  • November 1, 2019
  • 3 replies
  • 2415 views

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.
Best answer by Ankur_Khare

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

Ankur_Khare
Community Advisor
Ankur_KhareCommunity AdvisorAccepted solution
Community Advisor
November 1, 2019

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.

saurabhn3378167
November 5, 2019

Thank you but how to create xml using sling model.

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

arunpatidar
Community Advisor
Community Advisor
November 5, 2019