Hi All,
1)
I am trying to expose all components on the page in JSON format. When I use OOTB feature pageUrl.model.json, I see a lot of unnecessary data being shown, such as allowed components and other irrelevant details.
I want to expose a clean JSON and have already implemented Sling Models using jackson exporter, However, when I execute pageUrl.model.json, it doesn’t return the custom properties I've added in the Sling Model.
On the other hand, when I use componentPath.model.json, it returns all the custom properties from the Sling Model.
I'm trying to understand how to expose all component data as JSON via pageUrl.model.json.
2)
Additionally, I attempted to create a custom Sling Model for the page component, but this doesn't provide the JSON for all the components within the page. I thought about traversing through each child node and adapting each resource to a Sling Model, but the code below always returns null. The model doesn’t resolve to the correct Sling Model.
Object model = modelFactory.createModel(resource, Object.class); // This line always returns null
Text model = modelFactory.createModel(resource, Text.class); // This works mean resourceType Mapping is correct, but I want to dynamically bind the class name since I don't know which component is placed on page
Your input would be very helpful!