Don't blame
How not to serialize binary data:
import io.circe._
import com.google.protobuf.ByteString
final case class Message(body: ByteString)
object Message {
implicit val encodeMessage: Encoder[Message] =
Encoder.instance { message =>
val array = message.body.toByteArray
.map(_.toInt)
.map(Json.fromInt)
Json.fromValues(array)
}
}
Sadly, I actually saw this today… I didn’t do a git blame
; I guess I’d never be able to look at that person again 😢