1

I have a MariaDB database with a column of type JSON which contains a Json Array:

`loadArray01` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`loadArray01`))

In Maria DB a JSON column is a longtext one with a constraint as written above.

The problem is that when I try to deserialise the column in a Pojo with an List<Integer> I have a deserialisation error:

[ERROR] 13:01:53.323 fetchEvent() - org.jooq.exception.DataTypeException: Cannot convert from "[-8,-8,4,3,3,-12]" (class com.fasterxml.jackson.databind.node.TextNode) to interface java.util.List

I think the problem here is that Jackson think that the column is a Text one and from its point of view I am trying to convert a text into a List which is obviously not possible.

How could I help Jackson to deserialise the Array?

Stefano Bossi
  • 1,138
  • 1
  • 9
  • 19
  • Show us some code. What frameworks are you using, how are you trying to deserialize the data, etc.? Or maybe this helps? https://stackoverflow.com/questions/44308167/how-to-map-a-mysql-json-column-to-a-java-entity-property-using-jpa-and-hibernate – Benjamin M Aug 20 '21 at 11:36

0 Answers0