This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-07
Channels
- # beginners (49)
- # boot (48)
- # cider (5)
- # cljs-dev (6)
- # clojure (165)
- # clojure-android (1)
- # clojure-austin (1)
- # clojure-india (2)
- # clojure-italy (23)
- # clojure-nl (2)
- # clojure-poland (4)
- # clojure-russia (63)
- # clojure-spec (5)
- # clojure-uk (121)
- # clojurescript (187)
- # core-async (1)
- # core-logic (4)
- # cursive (17)
- # datascript (1)
- # datomic (12)
- # emacs (2)
- # funcool (3)
- # hoplon (2)
- # jobs (7)
- # juxt (6)
- # lambdaisland (1)
- # luminus (2)
- # lumo (20)
- # midje (8)
- # off-topic (11)
- # om (38)
- # onyx (42)
- # pedestal (6)
- # planck (23)
- # protorepl (29)
- # ring (3)
- # rum (23)
- # spacemacs (6)
- # untangled (70)
- # vim (1)
almost seems (from your, I imagine, way too simple example) that you could stick a set of parens around the string and read
it.
@slipset I guess I like to complicate things. The planck test is however for a larger front-end (web, i.e., CLJS) project. Just needed to do some tests w. planck.
New topic. I’ve been given a dataviz project this morning. I need to parse a 15,000,000 row csv file of traffic measurements data and a planck script seems appropriate for the processing/reduction of said data so that it can be mapped affordably (small bandwidth requirements) by client browsers.
Hence this quick question: what would you recommend for conversion of clojure structures into json strings?
This may seem simple but I have never had to deal with clj->json stuff.
So, sorry for what may seem like too simple a question.
Googled for it…
org.clojure/data.json
seems good for that.Question: is there an equivalent to “planck -c <jar>” for (planck) shell scripts?
Hmmm, as in
#!/usr/bin/env planck -c some.jar
… I hadn’t thought of that. Thanks @mfikes.Not working it seems (at least for org.clojure/data.json)...
The jar is in my .m2 repository
More precisely:
~/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar
Yet,
#!/usr/bin/env planck -c "src:~/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar"
(ns process.core
(:require [planck.core :as core :refer [slurp *command-line-args*]]
[org.clojure/data.json :as json]))
reports No such namespace: org.clojure/data.json, could not locate org/clojure_SLASH_data/json.cljs, org/clojure_SLASH_data/json.cljc, or Closure namespace “data.json”
Thought that was the problem.
Need to find a cljs-bootstrapped data -> json lib.
Search continues.
Almost too simple. What was I thinking?!
(defn ->json [edn]
(.stringify js/JSON (clj->js edn)))
and
(defn ->edn [json]
(js->clj (.parse js/JSON json) :keywordize-keys true))