How to create/expose JSON from Navigation Component?

Avatar

Avatar

saurabhn3378167

Avatar

saurabhn3378167

saurabhn3378167

01-11-2019

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Ankur_Khare

MVP

Avatar

Ankur_Khare

MVP

Ankur_Khare
MVP

01-11-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.

Answers (2)

Answers (2)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

05-11-2019

Avatar

Avatar

saurabhn3378167

Avatar

saurabhn3378167

saurabhn3378167

04-11-2019

Thank you but how to create xml using sling model.

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