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

Add pretty-printing support to write-json and friends. #2100

Closed
wants to merge 1 commit into from

Conversation

cwebber
Copy link

@cwebber cwebber commented May 24, 2018

New #:indent keyword which, if provided with an integer, will pretty-print output at that indentation level.

Licensed under MIT (Expat) / Apache V2 / LGPLv3+, Racket maintainers' pick.

New #:indent keyword which, if provided with an integer, will
pretty-print output at that indentation level.
@samth samth added the pr:good-to-merge A PR that seems ready to merge. label Jul 7, 2020
@samth
Copy link
Sponsor Member

samth commented Jul 7, 2020

This has a couple small conflicts now -- @cwebber can you resolve them?

@examples[#:eval ev
(with-output-to-string
(λ () (write-json #hasheq((waffle . (1 2 3))))))
(with-output-to-string
(λ () (write-json #hasheq((와플 . (1 2 3)))
#:encode 'all)))
(displayln
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to display, I think you can use write-json directly without displayln and with-output-to-string. For consistency though, I think it probably should evaluate to a string value.

@sorawee
Copy link
Collaborator

sorawee commented Jul 7, 2020

There probably should be tests? The test file is at https://github.com/racket/racket/blob/master/pkgs/racket-test/tests/json/json.rkt.

LiberalArtist added a commit to LiberalArtist/racket that referenced this pull request Jun 30, 2023
@jbclements jbclements closed this in 6f8824d Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:good-to-merge A PR that seems ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants