Hi there,
I was wondering if there is a specific way to convert a POJO to a nested
map without tripping over the following error:
"java.lang.IllegalArgumentException: Not a union.".
I've been trying with the following methods (w/ Jackson 2.2...maybe I
should update), but both have not been fruitful:
ObjectMapper mapper = new ObjectMapper();
// Convert POJO to MapMap<String, Object> map =
mapper.convertValue(foo, new TypeReference<Map<String, Object>>() {});
Source:
https://stackoverflow.com/questions/39543926/how-to-convert-pojo-to-map-and-vice-versa-in-java
// object -> Map
Map<String, Object> map = oMapper.convertValue(obj, Map.class);
System.out.println(map);
Source: https://www.mkyong.com/java/java-convert-object-to-map-example/
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.