Jackson JSON + Java Generics get LinkedHashMap
The following works and as per StaxMan’s advice no longer uses the deprecated static collectionType() method. public class SoApp { /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { System.out.println(“Hello World!”); String s = “[{\”user\”:\”TestCity\”,\”role\”:\”TestCountry\”},{\”user\”:\”TestCity\”,\”role\”:\”TestCountry\”}]”; StringReader sr = new StringReader(“{\”user\”:\”TestCity\”,\”role\”:\”TestCountry\”}”); //UserRole user = mapper.readValue(sr, UserRole.class); mapJsonToObjectList(s,UserRole.class); } protected … Read more