Answers for "ObjectMapper read list"

3

objectmapper convert list of objects

List<MyClass> myObjects = mapper.readValue(jsonInput, new TypeReference<List<MyClass>>(){});
Posted by: Guest on December-03-2020
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"

Browse Popular Code Answers by Language