Hi,
I am using nested multifield in AEM SPA with react .When I am trying to access the <page url>.model.json, nothing is rendered. But, when I try to retrieve with component node path,<page-node-path>.model.json, then it returns the component json.
Please let me know how can I retrieve nested multifield values in page model.json
Multifield Node Structure:
Page model.json:
Specific Component Model Json:
Code Snippet:
Thanks,
Divya
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @iamnjain
I am able to resolve this issue by adapting to SlingHttpServletRequest.class instead of Resource.class and added ComponentExporter.class and removed custom interface in adapters. I have added getter at class level.
Thank you for all your inputs.
Hello @Divya_13
Can you please try to tweak your main component sling model code a bit, as below
In your Model Interface, extends it with ComponentExporter class from
Hello @Divya_13
I just now observed in your main sling model Impl class, you are using @JsonIgnore annotation on all three child resources ( multifields ), so that's the reason It's not appearing in your page json. Can you please try removing that annotation and build and see if it works?
Hi @iamnjain
I have created a json array object(offices) and added all three child resources into the array and wanted to export this custom json object to page model json. So, I have added @JsonIgnore on other child resources and in the PostConstruct method I have set the property for the json obj.
Hi @iamnjain
I am able to resolve this issue by adapting to SlingHttpServletRequest.class instead of Resource.class and added ComponentExporter.class and removed custom interface in adapters. I have added getter at class level.
Thank you for all your inputs.
Ohh, I didn't noticed that in first glance.
Anyways thanks for letting me know and glad It's resolved for you!
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies