Open jshlbrd opened 2 years ago
great project, thanks for your contribution to open source!
i'm consistently experiencing some unusual behavior when setting byte values (the impacted code is here and here): when byte values are set, they are converted to a string and then (by default) encoded using the standard library's json.Marshal function, but (for reasons i don't understand) it appears that json.Unmarshal does not decode the value back to the original byte value. here's an example showing how SJSON's behavior mimics the behavior of the standard library, plus a "working example" using strconv to get the original bytes.
json.Marshal
json.Unmarshal
as an aside, was it a design decision for SJSON to not encode bytes as a base64 encoded string? that is how the standard library works and it would also solve the problem of consistently decoding back to the original value.
thanks!
great project, thanks for your contribution to open source!
i'm consistently experiencing some unusual behavior when setting byte values (the impacted code is here and here): when byte values are set, they are converted to a string and then (by default) encoded using the standard library's
json.Marshal
function, but (for reasons i don't understand) it appears thatjson.Unmarshal
does not decode the value back to the original byte value. here's an example showing how SJSON's behavior mimics the behavior of the standard library, plus a "working example" using strconv to get the original bytes.as an aside, was it a design decision for SJSON to not encode bytes as a base64 encoded string? that is how the standard library works and it would also solve the problem of consistently decoding back to the original value.
thanks!