Fork me on GitHub
#announcements
<
2020-01-29
>
wilkerlucio01:01:31

[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: https://github.com/wilkerlucio/edn-jsonΒ (edited)

πŸŽ‰ 5
p-himik02:01:47

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?

p-himik02:01:15

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

wilkerlucio02:01:18

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

wilkerlucio02:01:19

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

πŸ‘ 1
p-himik02:01:08

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.

wilkerlucio04:01:46

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: https://github.com/wilkerlucio/edn-json#encoding-decisions

πŸ‘ 1
niwinz09:01:25

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

niwinz09:01:58

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

p-himik09:01:22

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

p-himik09:01:55

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

p-himik09:01:33

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

niwinz09:01:25

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

lurodrigo16:01:39

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 https://github.com/polvotech/firestore-clj

πŸ‘ 7
πŸ”₯ 8
borkdude23:01:06

babashka, a native Clojure scripting tool, v0.0.67 adds clojure.test, hierarchies, multimethods and more: https://github.com/borkdude/babashka/releases/tag/v0.0.67 follow up in #babashka

πŸŽ‰ 22