0

Since Jersey projects start with Moxy JSON serializer by default, I used it for a multi module REST project. But writing clients to this REST API had it quirks, due to this known problem, that moxy doesn't work really well with Maps.

I've migrated the development branch of my code to Jackson, where hashmap serialization works well without the entry[] array, making it easier to write new non-jersey clients to the project. But I would also need to keep backwards compatibility somehow if possible, for already written clients. How could I achive this with Jackson?

Sadly some hashmaps dont have predetermined keys, so the solution showed in the link cant be implemented, if I'm not wrong.

logi0517
  • 813
  • 1
  • 13
  • 32
  • Do you have tests to show that Jackson serialization _wouldn't_ be backward compatible? The Jackson provider supports most JAXB annotations. For most use cases, the serialization should still be the same. – Paul Samsotha Jan 05 '18 at 22:56
  • Yeah, I tried to give the server the payload with the "entry array" like hashmap, and Jackson thrown a JsonMappingException not surprisingly. I solved other quirks, but I cant find a good solution for this one. – logi0517 Jan 06 '18 at 09:43
  • You might be able to use a custom JsonSerializer and JsonDeserializer – Paul Samsotha Jan 06 '18 at 10:25
  • I just found another thing moxy did automatically, but it's a pain in the ass with Jackson :( – logi0517 Jan 06 '18 at 10:39

0 Answers0