Sign in to Community
Sign in to view all badges
I am shashank singh. I am trying to read the node properties in json formate but i am getting the error message.. so is there any way to read the node property from dam path in json format.
You can read it using google gson API.
e.g. read node properties as ValueMap and convert this object into json using gson.toJson(valueMapObj)
Example, if you are doing this in servlet
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
ValueMap valueMap = req.getResourceResolver().getResource("/content/we-retail/jcr:content").getValueMap();
String jsonStr = gson.toJson(valueMapObj)
Note: for jcr:data or other binary type property can't be exposed in JSON, so remove from valueMap before converting to json.
Did you get a chance to go through Assets HTTP API or Content Fragments Support in AEM Assets HTTP API since your requirements use DAM path?
You could even use custom exporter based on the complexity of your use case.