Return "bytes" as array, not as base64 encoded string from custom codec


#1

I’ve noticed that if you return the bytes variable as a value to an attribute of an object, it comes as a base64 encoded string.

I am trying to standardize outputs of binary data as a string per the SenML spec for Data Values. My current option now is to return the bytes array as a string by calling the .toString() method on it.

If you create an array and return that, then it comes in as an array. However, if that new array has the same contents as the bytes variable that gets passed into the Decode function, then it becomes a base64 encoded string. Is there a way to force a new array to be base64 encoded? Or is calling the toString method the best option?