...
For typed languages (such as Java) Option B requires code generation and class loading. Class loading leads to issues with deployment complexity.
Option A lends itself to a low cost transformation to and from a REST interface with simple JSON payload (with generic JSON schema).