tidwall / sjson

Set JSON values very quickly in Go
MIT License
2.4k stars 165 forks source link

SetBytes with string slice as value is escaped #59

Closed arigon closed 2 years ago

arigon commented 2 years ago

Hello

I want to set a string slice as a value with SetBytes. Unfortunately the JSON marshaler seems to escape the quotes: {"data": "[\"test1\"]"}

How can I prevent this?

The expected result would be: {"data": ["test1"]}

arigon commented 2 years ago

Oh, I found the error. I was trying to add value.String() in a previous step. Adding the slice works fine.