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

Extraneous Spaces in Produced JSON String #19

Open
zoffixznet opened this issue Oct 1, 2015 · 1 comment
Open

Extraneous Spaces in Produced JSON String #19

zoffixznet opened this issue Oct 1, 2015 · 1 comment

Comments

@zoffixznet
Copy link
Contributor

Currrently, to-json { a => [1, 2, 'b'] }; produces this JSON string { "a" : [ 1, 2, "b" ] }. All of the spaces between the elements are not needed and the string {"a":[1,2,"b"]} is equivalent. All the extra spaces add unessesary bytes to the generated JSON string, which will likely be transmitted over the Internet or stored in a file.

Steps to reproduce:

Run this in the terminal: perl6 -e 'use JSON::Tiny; say to-json { a => [1, 2, "b"] };'

Expected result:

Outputted string is {"a":[1,2,"b"]}

Current result:

Outputted string is { "a" : [ 1, 2, "b" ] }

@moritz
Copy link
Owner

moritz commented Dec 24, 2016

FWIW this was intentional to make the JSON easier to read.

But I'm not proverbially married to this feature; if somebody wants to change it, I'd accept a pull request.

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