jsonista
jsonista copied to clipboard
InputStream question
Hello, I am looking to migrate from clojure.data.json to jsonista, but am unsure how to process an input stream of JSON encoded maps. Note I can't preprocess the input stream to be a vector of maps either.
In clojure.data.json I do this:
(loop [data []]
(if-let [datom
(try (json/read reader)
(catch java.io.EOFException _)
(catch Exception Ex
(log/error Ex)))]
(recur (conj data
datom))
data))
@archaic InputStream should be supported out of the box by ReadValue protocol.
Try using json/read-value.
Hello, after using ReadValue on either an InputStream or Reader, it works on the first value, the second value results in a StreamClosed exception. If I get time I will dig deeper, but its not a high priority as clojure.data.json is working for me.