jackson-dataformats-binary icon indicating copy to clipboard operation
jackson-dataformats-binary copied to clipboard

Jackson Ion Nested ArrayBuffer?

Open jfuehner opened this issue 4 years ago • 1 comments

Hi! Was curious if it is possible to nest a Java ByteBuffer within an Ion object? When de/serialized would it maintain that type?

For example say I have a class such as:

class Sample {
     String getId(){}
     ByteBuffer getChildren(){}
}

As an example with standard Jackson de/serializing to JSON the ByteBuffer loses its type as it is turned into a standard array... Was curious if de/serializing to/from an Ion object would allow it to maintain the ByteBuffer type...

jfuehner avatar May 21 '20 13:05 jfuehner

No, Jackson simply binds ByteBuffers to/from binary data. In theory polymorphic type handling could help, but I suspect that if this is something you really need to retain, custom (de)serializers might be the way to go. I don't think Ion as format matters a lot since while it has type ids (and ability to define multiple unlike other supported formats), mapping of that is handled by jackson-databind.

cowtowncoder avatar May 25 '20 04:05 cowtowncoder