parse a hashmap to gson object

I converted from hashmap<String,Integer> to json object and I got this result

//this code was used and it gave the below results
Gson builder = new GsonBuilder().setPrettyPrinting().create();
object.add("Body Info", builder.toJsonTree(c.getBodyInfo()));

"Body Info": {
    "Chest": 100,
    "Legs": 80,
    "Back": 50,
    "Height": 170,
    "Arm": 25,
    "Weight": 70
  }

I've been trying to do the opposite, to get from that result to hashmap, But i failed. someone can help? I am using google json lib



Read more here: https://stackoverflow.com/questions/64948122/parse-a-hashmap-to-gson-object

Content Attribution

This content was originally published by hatem ibrahem at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: