Yes, we can do it.Please have a look at this article :Link:-
http://www.nateyolles.com/blog/2015/12/converting-aem-sling-resources-to-json//
Converting AEM/Sling Resources to JSON : You can easily convert an AEM
Page, Sling Resource, or JCR Node to JSON using the
org.apache.sling.commons.json.jcr.JsonItemWriter class. Also have a look
at this example:Link:-
https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/servlets/impl/SampleAllM...