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

pretty print stream of data #74

Closed
strattonbrazil opened this issue Jan 15, 2015 · 2 comments
Closed

pretty print stream of data #74

strattonbrazil opened this issue Jan 15, 2015 · 2 comments

Comments

@strattonbrazil
Copy link

Is there a way to pretty-print a stream of data? I figured generate-string and generate-stream would have comparable options, but only generate-string seems to be pretty printed.

(println (generate-string data {:pretty true})) ; pretty-printed
(generate-stream data (clojure.java.io/writer "test.json")) {:pretty true}) ; not pretty-printed in file
@dakrone
Copy link
Owner

dakrone commented Jan 16, 2015

Cheshire already supports this:

cheshire.core> (generate-stream {:a "b", :foo "bar"} (java.io.StringWriter.) {:pretty true})
#<StringWriter {
  "foo" : "bar",
  "a" : "b"
}>
cheshire.core> (generate-stream {:a "b", :foo "bar"} (java.io.StringWriter.) {:pretty false})
#<StringWriter {"foo":"bar","a":"b"}>

Perhaps clojure's writer is swallowing the newlines?

What version of Cheshire are you using? Can you share example data that reproduces this?

@dakrone
Copy link
Owner

dakrone commented Jul 4, 2015

Closed with no feedback, feel free to re-open if needed.

@dakrone dakrone closed this as completed Jul 4, 2015
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