Fork me on GitHub

[com.wsscode/edn-json "1.0.4"] is out! New things on this version: - Add support for ::encode-value for custom value encoding - Add support for ::encode-map-key for custom map keys encoding Check it out at:Β (edited)

πŸŽ‰ 20

The README says: "Transit produces JSON suitable for faithful round-trips in and out of EDN types, but it’s not good for consuming as JSON." Could you explain why Transit is not good for consuming as JSON?


One thing I'd guess is that it represents maps as arrays.


the idea of this library is to be a middle term between preserving the original EDN and making it confortable for JSON tools to work with


one way to look at is, is imagine a version of clj->js that can reverse EDN later with more fidelity, makes sense?

πŸ‘ 4

Yeah, thanks. A strange thing I just noticed:

(= (edn->json :keyword) "__edn-value|:keyword")
(= (edn->json {:foo 42}) #js {":foo" 42})
By itself, a keyword is encoded, but as a key map, it is not. It makes it indistinguishable from strings that start with a colon.


yeah, that's a trade-off I was willing to make, given how common those are in the clojure world and how rare they are for regular JSON cases, more info:

πŸ‘ 4

Transit has :json-verbose option that conserves the structure (don't uses lists for objects...) and is pretty comfortable to parse as json...


Encoding {:foo "bar", :baz [1 2]} looks like {"~:foo":"bar","~:baz":[1,2]}


Oh, that's right! I completely missed that :json and :json-verbose differ in more than keyword caching.


Ah, not so fast - it still uses an array if there are composite keys.


{[0 1] 2} becomes {"~#cmap":[[0,1],2]}.


seesm something very unusual when you using a data structure that you have in mind share with "javascript" (or to be interporable with json...)


Hi folks! Released [polvo/firestore-clj "0.1.3"] It's a client for Google's Firestore database. It's quite idiomatic, supports both pulling data once and real-time data by materializing query results as atoms (and some lower-level stuff to). All functions are type-hinted so there's no reflection behind the scenes. Check it out at

πŸ‘ 28
πŸ”₯ 32

babashka, a native Clojure scripting tool, v0.0.67 adds clojure.test, hierarchies, multimethods and more: follow up in #babashka

πŸŽ‰ 88