I have a json of the below format
[
{
"id": "one",
"type": "Integer",
"value": "10"
},
{
"id": "two",
"type": "String",
"value": "StringValue"
},
{
"id": "three",
"type": "com.something.special",
"value": {
"splFiel1": "filedOne",
"splFiel2": "fielTwo",
"splFiel3": "fieldThree"
}
}
]
Each array element always will have three fields id,type and value. The structure of the field "value" will depend on the field "type" and can change based on that.
I would like to convert this json into Java object, so that i can easily access "value" obj and its sub fields easily . The reason i don't consider this as normal json to java object conversion is due to the varying field structure of "value" field based on the field "type" in the same json.
Can this be done?. I am trying to do this with jackson json, but please do suggest if you have better options.
Please provide any ideas, suggestions, reference links.