tidwall / sjson

Set JSON values very quickly in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetBytes with string slice as value is escaped

arigon opened this issue · comments

commented

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"]}

commented

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