Hi Tanmay,
We currently have the same requirement and came up with a possible solution:
<CMS_HEADER>
<CMS_FUNCTION name="Navigation" resultname="getNav">
<CMS_PARAM name="expansionVisibility" value="pathonly"/>
<CMS_PARAM name="wholePathSelected" value="1"/>
<CMS_VALUE_PARAM name="root" value='"pagefolder:"+ss_navigation_root' />
<CMS_PARAM name="siteMap" value="1" />
<CMS_ARRAY_PARAM name="selectedHTML">
<CMS_ARRAY_ELEMENT index="0..10">
<![CDATA[$CMS_TRIM(level:4)$
/$CMS_VALUE(#nav.ref.getFilename().replace("_", "-"))$
$CMS_SET(prevLabel,#nav.ref.getFilename())$
$CMS_END_TRIM$]]>
</CMS_ARRAY_ELEMENT>
</CMS_ARRAY_PARAM>
<CMS_ARRAY_PARAM name="pageRefRendering">
<CMS_ARRAY_ELEMENT index="0..10"><![CDATA[$CMS_TRIM(level:4)$
$CMS_IF(prevLabel.equals(#global.node.getFilename()) == false)$
/$CMS_VALUE(#global.node.getFilename().replace("_", "-"))$
$CMS_END_IF$
$CMS_SET(prevLabel,#global.node.getFilename())$
$CMS_END_TRIM$]]></CMS_ARRAY_ELEMENT>
</CMS_ARRAY_PARAM>
</CMS_FUNCTION>
</CMS_HEADER>
{
"url": "$CMS_VALUE(getNav)$",
"pageData": $CMS_VALUE(#global.page.toHtml())$
}
We use the "Navigation" CMS Function here to create the path and then append it to the json of the page with the "url" key.
The result will look like this for example:
{
"url": "/ratgeber/foerdermittel/kfw-programme-im-ueberblick",
"pageData": {"fsType":"Page",...}
}
I hope I could help you
Timon