Message Boards
How to display Blob /Json data field?
How to display Blob /Json data field?
New Member Post: 1 Join Date: 2/14/21 Recent PostsI am using service builder that is retrieving the form data fine from mysql db. I have a field that has the json data and I tried to map it using object mapper and using com.fasterxml.jackson.databind.ObjectMapper to display the json content. However the Blob Data is shown as : com.mysql.cj.jdbc.Blob@4ca74f7f
How do I actually get/extract the data from the storing link above? Here is my code snippet:
for (ddmcontent MyTemp : myList) {
System.out.println("Content ID :
"+myList.getContentId());
System.out.println("User Blob Data :
"+myList.getData());
Blob responseBody =myList.getData();
ObjectMapper objectMapper = new ObjectMapper();
List<ModelData> myDat = objectMapper.readValue((DataInput)
responseBody,objectMapper.getTypeFactory().constructCollectionType(List.class,ModelData.class));
for (ModelData dt : myDat) {
System.out.println("User Name :
"+dt.Name);
System.out.println("Users
Email : "+dt.Email);
}
}
Please note I have defined my ModelData elements as all String.
Any suggestion? What am I missing?
Thanks in advance!