jackson-dataformats-binary
jackson-dataformats-binary copied to clipboard
Jackson Ion Nested ArrayBuffer?
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...
No, Jackson simply binds ByteBuffer
s 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
.