Need JSON in Value Format
Hi All,
I have written below JAVA to get my JSON response from Content Fragment.
public static JsonArray getMultiValueAsArray(String contentPath, Value[] values, ResourceResolver resourceResolver) throws RepositoryException {
JsonArray array = new JsonArray();
if (values != null) {
for (Value propertyValue : values) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonObj = jsonParser.parse(propertyValue.getString());
logger.info("jsonObj inside getMultiValueAsArray ===== "+jsonObj);
array.add(jsonDataParser(contentPath, jsonObj, resourceResolver));
}
}
return array;
}
And my JSOn is coming below. Here my multifield is storing as STRING [] array , as shown below.


But here my requirement is that I want my JSOn format should come like below.

Can somebody please let me know what kind of changes I need to do in my JAVA so the format will come like above.
Thanks & Regards
Subrat