Returns element as a ByteArray, converting scalar types when possible.
element as ByteArray or empty ByteArray if fail.