0

I am using org.codehaus.jackson.map.ObjectMapper to deserialize json data sent a client. But client is sending class definition in the JSON. Is there a way to ignore class definition info in the json and convert it to required Java Bean using ObjectMapper.

Note : Could not fix client code or define a class with same package structure as sent by client in the server side due to cross release supports. So finding a easy way to ignore class definition in the payload and convert it to required java bean as per server side impl.

user2702700
  • 639
  • 2
  • 11
  • 26
  • looks like a duplicate of https://stackoverflow.com/questions/4486787/jackson-with-json-unrecognized-field-not-marked-as-ignorable/12730655#12730655 – user3624390 Jul 13 '18 at 12:18

1 Answers1

0

You can decorate the response java class with

@JsonIgnoreProperties(ignoreUnknown = true)

to ensure that unmapped properties in the json will be not considered during unmarshalling

Roberto Canini
  • 340
  • 1
  • 3
  • 13
  • This can be used to ignore some properties in json. Lets say JSON has class definition info and actual data, then I want to parse only actual payload attributes and ignore class definition. – user2702700 Jul 16 '18 at 04:54