@Test public void testRecursiveMap() { Map outerMap = new HashMap<>(); Map innerMap = new HashMap<>(); Holder holder = new Holder(); holder.setH("myValueInH"); innerMap.put("level2", holder); outerMap.put("level1", innerMap); Marshaller marshaller = MarshallerFactory.getMarshaller( MarshallingFormat.JSON, getClass().getClassLoader() ); Map mu_outerMap = marshaller.unmarshall( marshaller.marshall( outerMap ), Map.class ); Map mu_innerMap = marshaller.unmarshall( marshaller.marshall( innerMap ), Map.class ); Ref ref = new Ref(); ref.setR(innerMap); Ref mu_ref = marshaller.unmarshall( marshaller.marshall( ref ), Ref.class ); assertEquals( "verify that Ref.r is not being serialized with JSONMarshaller.WrappingObjectSerializer, but with the specified one in @JsonSerialize", mu_innerMap.entrySet(), ((Map)mu_ref.getR()).entrySet() ); }