square / moshi

A modern JSON library for Kotlin and Java.
https://square.github.io/moshi/1.x/
Apache License 2.0
9.74k stars 758 forks source link

Byte Adapters encode wrong Value #1891

Closed Andy3189 closed 1 week ago

Andy3189 commented 1 week ago

The Standard Adapter for byte values encodes a wrong value for negative Byte values (https://github.com/square/moshi/blob/master/moshi/src/main/java/com/squareup/moshi/StandardJsonAdapters.kt:L85)

The same Issue applies to the Java implementation.

Heres an example https://gist.github.com/Andy3189/2110ce41e3159022cb3bdf646b0fa1e7