Inline classes and JSON serialization

Hi Folks,

do you have any propositions how to deal with inline classes and JSON serialization (e.G. Jackson). I’m looking for a general strategy, so my question is more conceptional than implementation.

To me, the main reason to use inline classes is to support semantic data types. Especially in context of business applications (in backend) there is on one hand nothing as a string (which is unlimited), but it has a maximum length and is stored in a DB and on the other hand, I want the type system to ensure my domain logic integrity (StreetName is not the same as OrderNumber, even if both represented as a string).

If my application deals with converting data from and to different formats (e.G. JSON), I want to make sure that I encapsulate the conversion logic in one place (and test it there). This would mean - I should convert directly from JSON into instances of inline classes and back.

Apart from technical difficulty to achieve this (kotlin-jackson module doesn’t support inline classes so far), would you suggest to do so, or do I make any conceptional mistake?

Kind regards,