Fork me on GitHub
#clojure
<
2021-12-24
>
emccue02:12:03

> Spec > Currently this specification is casual, as we gather feedback from implementors. A more rigorous e.g. BNF will follow. Do we have a rigorous EDN spec?

andy.fingerhut03:12:43

If one were, I would expect it would be published in this repo: https://github.com/edn-format/edn. There is not one there, so I believe the answer is "no, no more rigorous than is in that repo".

Muhammad Hamza Chippa12:12:54

How to convert json to map in clojure ?

Muhammad Hamza Chippa12:12:52

{"event":[{"event_dates":[{"event_date_timestamp":"2016-01-19T19:00:00"}, {"event_date_timestamp":"2016-09-13T19:00:00"}, {"event_date_timestamp":"2017-02-27T19:00:00"}, {"event_date_timestamp":"2017-04-12T19:00:00"}]}]}

Muhammad Hamza Chippa12:12:05

I have this type of data and want to convert it into clojure map

Muhammad Hamza Chippa12:12:01

I am getting this error while importing namespace

anonimitoraf12:12:29

I think that's because you dont have it installed

Muhammad Hamza Chippa12:12:49

Thank you bro it did work for me

pavlosmelissinos13:12:20

FYI if you don't need the extra features that these libraries offer (like speed), clojure.data.json has no dependencies and to me is usually a better first choice

Muhammad Hamza Chippa13:12:28

@UEQPKG7HQ (json/read-str data :key-fn keyword) ?

1
seancorfield18:12:32

@U02DQ45FQF9 These are questions best suited to the #beginners channel.

👍 1
Muhammad Hamza Chippa13:12:59

I have date like this "2016-01-19T19:00:00" how can I generate the formatted date using clojure, in cljs I was using js/Date. but it is not available in clojure

pavlosmelissinos13:12:52

Java time is... complicated. Interop with java.time is a popular choice but if you don't like that there's a bunch of libraries that offer a more idiomatic API. Avoid anything based on joda time (it's an older way of handling time in java)

Muhammad Hamza Chippa13:12:12

what about clj-time ?

R.A. Porter14:12:29

I highly recommend juxt/time as a library that will interop with both Clojure and Clojurescript.

1
seancorfield18:12:41

clj-time is deprecated and should not be used unless you are still on Java 7 (as it says in the readme). Also, this sort of question really belongs in #beginners

👍 1
Alexander Kaiser18:12:45

@U01GXCWSRMW you are referring to juxt/tick, right? I am very happy with that one as well.

☝️ 1
Muhammad Hamza Chippa20:12:47

java.time worked fine for me

R.A. Porter20:12:12

Yes. Mistyped while tired. 😀

Muhammad Hamza Chippa20:12:25

I have a list of urls in a vector [url1 url2 .. urln] and I am trying to do a map on it using code given this {:response (doall (map (fn [url] (let [response (client/get url {:query-params {:auth "KesmU1sqxt8wS"}}) ;response-data (:rows (:data (json/read-str (:body response) :key-fn keyword))) ] response-data ))) urls)} but I am getting error and not getting a response whereas when I am calling client/get it is working perfectly fine, what could be the problem in that ?

p-himik20:12:49

And what is the error?

Muhammad Hamza Chippa20:12:12

:message clojure.core$map$fn__5880 cannot be cast to java.lang.Number

p-himik20:12:22

First of all, please format your code so it's readable. Don't do it via UI - do it via triple backticks, then it will be a multiline block with proper formatting. Second of all, whenever you post errors, post them with full stacktrace. Just the message is often useless. Also, your code above seems to be simply broken since the line that binds response-data is commented out.

Muhammad Hamza Chippa20:12:52

should I repost this with proper format ?

p-himik20:12:49

You can edit messages on Slack, no need to repost.

p-himik20:12:48

And finally, as Sean has mentioned twice already, please direct such questions to #beginners. They really do belong there.

1
Muhammad Hamza Chippa20:12:59

oops that is my mistake I accidentally posted in the clojure sorry for the inconvenience

👍 1
valerauko23:12:13

I saw some references to IntelliJ's VSCode competitor Jetbrains Fleet. I couldn't get a preview, but I was wondering if anyone could try it out with Clojure?