from a server I get an array of bytes, but Kotlinx serializable doesen't seem to like it as it can't parse it to the native Kotlin datatype ByteArray
and logs the error Unexpected JSON token at offset 902: Failed to parse 'byte'
:
JSON = "my_bytes": "[[22, 124, 78, etc...], [233, 89, 112, etc...], [etc...]]"
and I wanna serialize that into a ByteArray
so I can then write a file with that ByteArray
with the File.writeBytes(my_byte_array)
My code by the way:
import kotlinx.serialization.Serializable
@Serializable
data class ServerResponse(
val audio: List<ByteArray>
)