This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-28
Channels
- # announcements (5)
- # asami (34)
- # babashka (15)
- # beginners (222)
- # calva (5)
- # cider (2)
- # circleci (4)
- # cljfx (11)
- # clojure (34)
- # clojure-europe (10)
- # clojure-nl (2)
- # clojure-taiwan (2)
- # clojure-uk (5)
- # clojurescript (27)
- # conjure (8)
- # cryogen (11)
- # cursive (11)
- # datomic (7)
- # depstar (6)
- # fulcro (29)
- # graalvm (2)
- # joker (3)
- # kaocha (9)
- # nrepl (4)
- # off-topic (9)
- # pathom (1)
- # shadow-cljs (11)
- # spacemacs (4)
- # sql (1)
- # tools-deps (12)
Hi. I’m looking into using next-jdbc
and I’m trying to get it working with the Postgres JSON and array datatypes. I’ve added the suggested ReadableColumn extensions for https://github.com/seancorfield/next-jdbc/blob/c76d2241a8d6f26bc86975a91cb7c6615f1118a6/doc/tips-and-tricks.md#working-with-arrays and https://github.com/seancorfield/next-jdbc/blob/c76d2241a8d6f26bc86975a91cb7c6615f1118a6/doc/tips-and-tricks.md#working-with-json-and-jsonb (code exactly as shown in those links) and they seem to be working for the simple case:
(jdbc/execute-one! ds ["select ARRAY[1,2];"]) ;; => {:array [1 2]}
(jdbc/execute-one! ds ["select json_build_object('id', 1, 'name', 'test');"]) ;; => {:json-build-object {:name "test", :id 1}}
However, when I have some json within an array I still get the PGobject rather then the json:
(jdbc/execute-one! ds ["select ARRAY[json_build_object('id', 1, 'name', 'test')];"])
;; => {:array [#object[org.postgresql.util.PGobject 0x2ec40fa4 "{\"id\" : 1, \"name\" : \"test\"}"]]}
Does anyone know what needs to be adjusted to make this case work too?