Closed waltcow closed 1 year ago
You are running into multiple subtle ambiguities.
First is PostgreSQL array vs. JSON array. JSONBArray
represents a PostgreSQL array of jsonb
not a JSON document that happens to be an array.
Next is whether a Go string contains encoded JSON or needs to be encoded into JSON. e.g. is []
already JSON or is it a string that needs to be encoded to "[]"
.
You probably want a jsonb
that stores a JSON array rather than a PostgreSQL array of jsonb
.
Thanks for letting me know the difference between JSONBArray
and JSON array
, I will try jsonb
to store my JSON array
Hello, I am using JSONBArray to store jsonb string array value
JSONBArray
parse details as followwhen value encode into
byte[]
, it call EncodeText method, result as string is{admin, user}
, expected value should be["admin", "user"]
, I am not sure if my usage is right ?