Fork me on GitHub
#babashka
<
2023-05-15
>
joakimen13:05:11

Is there currently anything built into babashka for parsing ndjson? Parsing multiple objects with cheshire only returns the first one

(json/parse-string
 "{\"color\": \"blue\"}{\"color\": \"green\"}"
 true) ;; => {:color "blue"}

borkdude13:05:32

what is ndjson?

joakimen13:05:55

newline-delimited json, http://ndjson.org/

joakimen13:05:28

its a somewhat weird format, but i've encountered it through work several times last year, and again today

borkdude13:05:32

cheshire exposes parsed-seq for this

mario-star 2
joakimen13:05:52

Awesome, will give it a look!

borkdude13:05:16

user=> (require '[cheshire.core :as json])
nil
user=> (json/parsed-seq (java.io.StringReader. "{} {}"))
({} {})

👀 2
joakimen07:05:54

Got it working, thanks for the tip 🙇

👍 2
pesterhazy16:05:12

Is https://babashka.org/ down or is it just me?

4
pesterhazy16:05:19

Now it's working again, weird

borkdude17:05:07

Probably GitHub messing around again.