how to let jackson deserialize guava multimap using the '@class' field inside json to deside the target class?

87 Views Asked by At

I have a json like this:

{
  '@class':'A',
  'aProperty':{
    '@class': 'com.google.common.collect.ArrayListMultimap',
    'a':[1,2,3],
    'b':[22]
  }
}

and the class A like this:

class A{
  Object aProperty;
}

when I deserialize the json, jackson cannot use the correct keySerializer because the type of aProperty is Object. so I wish there is a way to config jackson and let it use the information from @class to decide which keySerializer to use, but I didn't find it. does someone know how to config?

0

There are 0 best solutions below