I have an JSON like object, which also has some binary values.
I do not want the binary(byte[]) data to be serialized.
I have tried to add custom serializer for byte[]. But it didn't worked out.
Try 1:
public class ByteArraySerialiser extends SerializerBase<Byte[]> {
protected ByteArraySerialiser() {
super(Byte[].class, false);
}
@Override
public void serialize(Byte[] arg0, JsonGenerator arg1,
SerializerProvider arg2) throws IOException,
JsonGenerationException {
arg1.writeString("");
}
}
Try 2:
public class ByteArraySerialiser extends SerializerBase<Byte> {
protected ByteArraySerialiser() {
super(Byte.class, false);
}
@Override
public void serialize(Byte arg0, JsonGenerator arg1,
SerializerProvider arg2) throws IOException,
JsonGenerationException {
arg1.writeString("");
}
}
But, both are failing to override the default serializer.
I could not use annotation because, its a Map<Object, Object>.
Thanks.