Below is my Json. I want to get the value of "Id" inside "Details" using Gson
{
"name": "testAutomation-1",
"owner": "TestUSer",
"description": "testAutomation-1",
"subSet": [
"test-audit"
],
"labels": "{\"engagementType\":\"Sx\",\"type\":\"collect\"}",
"createdTime": 1548508294790,
"updatedTime": 1548654725381,
"scheduleDateTime": null,
"timeZone": null,
"jobStatus": "Report-Requested",
"loggedInUser": null,
"Details": [
{
"Status": "Completed",
"Id": "fe1f6b40-216b-11e9-a769-25be4c5889e7"
}
]
}
I created a map using the below code. But not sure how to get the value
Map<String, Object> createmap = new HashMap<String, Object>();
Gson gson = new Gson();
Type type = new TypeToken<Map<String, Object>>(){}.getType();
createmap = gson.fromJson(jsonobj.toString(), type);
System.out.println(((List<Map<String,Object>>)createmap.get("Details")).get(0).get("Id"))