is there any way to pass jsonString using @Exporter(name = "jackson", extensions = "json")
package com.test.web.core.models;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import com.test.web.core.util.InsightUtil;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Model(
adaptables = Resource.class,
resourceType="test-web/components/content/secondaryNav"
)
@3484101(name = "jackson", extensions = "json")
public class SecondaryNavigationModel {
private final Logger logger = LoggerFactory.getLogger(getClass());
/**
* The Resource type.
*/
@586265
@Named("sling:resourceType")
@1497330(values = "No resourceType")
protected String resourceType;
@586265
@Optional
private String headerText;
@586265
@Optional
private String headerBackgroundColor;
@586265
@Optional
private String mobileHeaderTitle;
@586265
@Optional
private String headerLinkPath;
@586265
@Optional
private List<Resource> menuItems;
@586265
ResourceResolver resourceResolver;
private List<MenuItem> menuItemsList = new ArrayList<>();
public String getHeaderLinkPath() {
return headerLinkPath;
}
public void setHeaderLinkPath(String headerLinkPath) {
this.headerLinkPath = headerLinkPath;
}
public String getMobileHeaderTitle() {
return mobileHeaderTitle;
}
public void setMobileHeaderTitle(String mobileHeaderTitle) {
this.mobileHeaderTitle = mobileHeaderTitle;
}
public String getHeaderText() {
return headerText;
}
public void setHeaderText(String headerText) {
this.headerText = headerText;
}
public String getHeaderBackgroundColor() {
return headerBackgroundColor;
}
public void setHeaderBackgroundColor(String headerBackgroundColor) {
this.headerBackgroundColor = headerBackgroundColor;
}
public List<MenuItem> getMenuItemsList() {
return menuItemsList;
}
public void setMenuItemsList(List<MenuItem> menuItemsList) {
this.menuItemsList = menuItemsList;
}
/**
* Init.
*/
@PostConstruct
protected void init() {
// set prepared path for headerLinkPath to support EMEA
if(this.headerLinkPath != null && this.headerLinkPath.startsWith("/content/insight-web")) {
this.setHeaderLinkPath(InsightUtil.getPreparedPath(this.headerLinkPath));
}
if (menuItems != null && !menuItems.isEmpty()) {
for (Resource resource : menuItems) {
MenuItem menuItem = resource.adaptTo(MenuItem.class);
menuItemsList.add(menuItem);
}
}
}
}
<sly data-sly-use.templates="core/wcm/components/commons/v1/templates.html"/>
<sly data-sly-call="${templates.placeholder @ isEmpty = component.editable}"></sly>
<div data-cmp-type="react" data-sly-use.secondaryNavModel="com.test.web.core.models.SecondaryNavigationModel"
data-component="test" data-component-data=${-----?-----how to pas json}></div>
how to pas json in to sightly