PGobject type conversion in Clojure

Viewed 1164

I'm having trouble with a type conversion problem in Clojure, using Hugsql. I'm new to Clojure and newer to SQL, and I'd appreciate any help I can get.

We recently migrated our PostgreSQL db so one column is a json array instead of a string -- the migration looks like:

ALTER TABLE customers ALTER id TYPE JSON USING json_build_array(id);

But now when I make query for that data, the type is a PGobject and not a collection like I was hoping. While I'm looking for:

  • ["id-123"]

the actual returned value is

  • #object[org.postgresql.util.PGobject 0x7ff0434e "[\"id-123\"]"]

I spent some time looking up how to do the type conversion, but had no luck. How can I convert the type of this response to a collection or sequence in Clojure? Thanks for your help!

1 Answers
Related