Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set value type error! #52

Open
xuzhuoxi opened this issue Nov 29, 2021 · 1 comment
Open

Set value type error! #52

xuzhuoxi opened this issue Nov 29, 2021 · 1 comment

Comments

@xuzhuoxi
Copy link

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

@tidwall
Copy link
Owner

tidwall commented Nov 29, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants