Fork me on GitHub
#luminus
<
2017-05-26
>
vetalik12:05:40

@jmayaalv Thank you! Looks like i have configured project incorrectly. I have played with several project built by lein for luminus and found critical difference

vetalik12:05:05

New question. I have an Oracle database. Query that works. ANd i'm getting lazySeq of maps from DB. How do i transform lazySql of Map to JSON? So that i could sent it through Swagger API. Best thing i was able to get was string with escaped symbols instead of JSON? function is very simple

vetalik12:05:40

and result looks like mess

"[{\"file_name\":\"msg_generated_556de7a06097.xml\",\"work_order_id\":\"03048653-9030-4279-b0f0-556de7a06097\",\"veid\":\"ROKSAN123\",\"rn\":1,\"val_failed\":0,\"cfi\":\"D\",\"em_stat\":\"SUCCESS\",\"dr\":null,\"val_stat\":\"PASS\",\"record_count\":1,\"content_type\":\"dsss\",\"latest_timestamp\":\"2017-05-23 08:29:07\",\"error_codes\":null,\"ref_num\":\"M424238144406\",\"time_stamp\":\"2017-05-23 08:29:04\"},

jmayaalv12:05:52

glad you solved the first issue 🙂

jmayaalv12:05:59

i don’t think you need to make any transformation. You can sent the clojure map just fine. If you specify the content-type as text/json the app should return json

jmayaalv12:05:44

the transformation is already done for you. i believe the middleware ring-json is used underhood for this. https://github.com/ring-clojure/ring-json

jmayaalv12:05:54

also luminus comes with a dependency to https://github.com/dakrone/cheshire it’s quiet good to handle json encoding/decoding.

vetalik12:05:11

Great! It works now. :return String was my error

jmayaalv12:05:34

but i think for your usecase you should let ring do it for you. much simpler. and you can support multiple types (edn, transit, xml, etc) for “free”.

vetalik12:05:05

yes, works perfectly. Thank you!