in my code i have
// the JsonObject is of the type com.google.gson
final JsonObject mdata = niceservice.nicemethod();
.nicemethod() returns the following JsonObject
{
"Customer": {
"name": "John Doe",
"gender": "Male"
},
"AdditioanInfo": {
"samplefield1": "sampleValue1",
"samplefield2": "sampleValue2",
"samplefield3": "sampleValue3",
"SubAdditionalInfo": {
"SubAdditionalInfo1": "SubAdditionalValue1",
"SubAdditionalInfo2": "SubAdditionalValue2",
"SubAdditionalInfo3": "SubAdditionalValue3",
"SubSubInfo": {
"SubSubInfo1" : "SubSubInfoValue1",
"SubSubInfo2" : "SubSubInfoValue2",
"SubSubInfo3" : "SubSubInfoValue3"
}
},
"ExtraInfo": {
"ExtraInfo1" : "Extravalue1",
"ExtraInfo2" : "Extravalue2"
}
}
}
so far i have tried
final ObjectMapper objMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
ModernCustomer objc = objMapper.readValue(mdata.toString), ModernCustomer.class));
but i do not think this is the right way to do this as it does nothing. considering I am new to java, please kindly educate me to the fullest on how to resolve this issue
Note: usage of 3rd party libraries might be limited due to my org policies.
New contributor