tidwall / sjson

Set JSON values very quickly in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set value type error!

xuzhuoxi opened this issue · comments

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

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.