I am using javatuples as I have to return multiple arguments from few of my methods calls.
Everything seem good until I tried to deserialize a jsonString in to a Triplet. Seems the tuples classes(Triplet etc) don't have a no-args constructor, so jackson is not able to deserialize.
My code is roughly as below -
String json = """{"size":3,"value0":["dataPoint1", "dataPoint2"],"value1":["dataPoint3"],"value2":["dataPoint2", "dataPoint3"]}""";
Triplet<List<String>, List<String>, List<String>> serviceResponse = objectMapper.readValue(json, new TypeReference<>(){});
And the exception I am getting is -
Cannot construct instance of
org.javatuples.Triplet(no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
DO I HAVE ANY OTHER WORK AROUNDS? My actual data i very huge so deserilzation approach is required for my case. Are there any jackson configuration etc that can fix this issue.
I am thinking a Custom JsonDeserializer might help. But other simple solutions are welcome too.
The JSON Object seems to map to
Why not deserialize into this object ?