Answers for "objectMapper read list of type"

0

objectMapper read list of type

// As array (then convert to a list)
MyClass[] myObjects = mapper.readValue(json, MyClass[].class);

// With TypeReference
List<MyClass> myObjects = mapper.readValue(jsonInput, new TypeReference<List<MyClass>>(){});

// with TypeFactory
List<MyClass> myObjects = mapper.readValue(jsonInput, mapper.getTypeFactory().constructCollectionType(List.class, MyClass.class));
Posted by: Guest on June-14-2021

Code answers related to "objectMapper read list of type"

Browse Popular Code Answers by Language