on-internet
← Community

How to convert JsonNode to Map

Stack Overflow ·

using play framework java on the server i'm using graphiql to make requests, when i do final JsonNode variables = request().body().asJson().get("variables"), a JsonNode with a value "{\"id\":\"bar\"}" , now i want to convert this JsonNode to a Map, i tried Json.mapper().convertValue(variables, new TypeReference<HashMap<String, Object>>() { }); but i keep getting this exception Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [map type; class java.util.HashMap, [simple type, class java.lang.String] -> [simple type, class java.lang.Object]] from S

Comments

Sign in or sign up to comment and upvote.

No comments yet.