Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputStream question #59

Open
archaic opened this issue Oct 21, 2021 · 2 comments
Open

InputStream question #59

archaic opened this issue Oct 21, 2021 · 2 comments

Comments

@archaic
Copy link

archaic commented Oct 21, 2021

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))
@FieryCod
Copy link
Contributor

@archaic InputStream should be supported out of the box by ReadValue protocol.

Try using json/read-value.

@archaic
Copy link
Author

archaic commented Feb 28, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants