nwidger/jsoncolor

Encoder does not print newlines

Closed this issue · 3 comments

Here's an example: https://goplay.space/#aJgJu9bSfOV

From looking at the code, it looks like the encoder prints a newline via printSpace which is disabled if compact=true. AFAICT, those are only relevant to MarshalIndent.

Here's the corresponding encoding/json version which does print the newline: https://goplay.space/#35zNP_wOjQy

@colinking Thanks for reporting this issue! I opened a PR #6 that I hope will fix this issue. Would you mind trying out the issue-5-encoder-does-not-print-newlines branch and letting me know?

Thanks for such a quick fix @nwidger! Sorry about the delay. Just gave it a test. LGTM!