Hi all,
I am implementing AEM site search functionality using elastic search. My requirement is to extract the page content as json and push it to Elastic search for indexing. I will have to do this on author on an event .
I have implemented this using com.day.cq.commons.TidyJsonItemWriter and jsonWriter.dump(node, out, 10) which gives me desired output . My concern is, this method throws JSONException which is of class org.apache.sling.commons.json.JSONException; and its a deprecated hence i don't want to use it . Could some one suggest what would be the best way to achieve json dump for my page content including all the components in a page.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
You can use gson from google.
Example https://aemlab.blogspot.com/2019/07/get-json-response-of-aem-page.html
Although Sling Commons JSON is deprecated, it's not going to be removed in the AEM product anytime soon (at least until a replacement is provided).
If it works right now for you, I would stick with it.
Thanks for the response . I might just stick with Json writer for now in that case
Hi ,
The solution in that thread can not be applied in my case as I want to extract the json dump of the content for already built components and pages so that i can index the content in elastic cache. Thank you so much for the response
Hi,
You can use gson from google.
Example https://aemlab.blogspot.com/2019/07/get-json-response-of-aem-page.html
Thanks for the response . This looks good as alternative to get the Json dump .
Views
Likes
Replies