sjson icon indicating copy to clipboard operation
sjson copied to clipboard

Set value type error!

Open xuzhuoxi opened this issue 4 years ago • 1 comments

sjson.Set(b.content, path, []uint8{1, 2, 3, 4}) value type "[]uint8" will change to "string"

xuzhuoxi avatar Nov 29 '21 08:11 xuzhuoxi

Go treats []byte and []uint8 as the same thing, and sjson treats []byte as a string.

https://github.com/tidwall/sjson/blob/master/sjson.go#L674-L676

There's no way, that I know of, to make a distinction between []byte and []uint8.

tidwall avatar Nov 29 '21 23:11 tidwall