My Json repose from server looks like below
{
"duration": 0,
"taskSummaries": [
{
"name": null,
"id": 151,
"priority": 0,
"content": "{\"Comment\":\"Employee:{name}\",\"TaskName\":\"employeeForm\",\"GroupId\":\"HR\",\"NodeName\":\"Employee Form\"}",
"processId": "demoProject1.busiProce1",
"description": null,
"subject": null,
"statusMessage": "Ready",
"itemID": "com.demo.tp15:demoProject1:1.0",
"potentialOwners": [
{
"name": "mary",
"type": "USER"
}
],
"skippable": true,
"actualOwner": null,
"createdBy": null,
"createdOn": null,
"activationTime": 1412582092211,
"processInstanceId": 172,
"processSessionId": 0,
"quickTaskSummary": null,
"parentId": null
}
],
"statusMessage": "200",
"itemID": null,
"processInstanceId": 172,
"startURL": null,
"processAppID": "demoProject1.busiProce1",
"processAppName": null,
"processState": {
"description": "Active",
"code": 1
},
"dueDate": null,
"startDt": null,
"endDt": null,
"parentProcessInstanceId": 0,
"outcome": null,
"identity": null,
"processVersion": null,
"processName": null,
"externalId": null
}
and i don't have control over my pojo/model object also ...as per my coding standard i have to follow naming convention for example taskSummaries will be tskSumris,name is nme,Employee is empl ..
My Question here is : I want to dynamically assign my Json string to my pojo/model when the name in json String and pojo doesnt match.
I know (in fact i have done also )if i have names are matching then i could do something like this
private Object getDynamicObject(String jsonString,Class class1) throws JsonParseException, JsonMappingException, IOException{
ObjectMapper mapper = new ObjectMapper();
Object dynamicObject = null;
dynamicObject = mapper.readValue(jsonString, class1);
return dynamicObject;
}
Can you guys please help me.