Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5421 closed defect (fixed)

get rid of space in the output of toJson if prettyPrint=false

Reported by: liucougar Owned by: liucougar
Priority: high Milestone: 1.1
Component: General Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description

the spaces in the output of toJson is not necessary

the patch change it so that it only adds in spaces if prettyPrint=true

Attachments (1)

5421.patch (965 bytes) - added by liucougar 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by liucougar

Attachment: 5421.patch added

comment:1 Changed 11 years ago by Adam Peller

+1 on the concept. It might be a bit more concise to express this as a single sep variable of " " or "" and just append it in both cases. Since this is base, every byte counts.

comment:2 Changed 11 years ago by Adam Peller

also, I have to wonder if the indent string were meant to appear before and in between each element in hashes and arrays instead of just after the join?

comment:3 Changed 11 years ago by liucougar

Resolution: fixed
Status: newclosed

(In [11863]) fixes #5421

comment:4 Changed 11 years ago by Adam Peller

(In [11864]) Fix xhr unit test for json pp change. Also, reduce json code some more. Refs #5421

comment:5 Changed 11 years ago by Dustin Machi

Just a quick note that this was originally changed to have the space to solve another ticket because the space is part of the JSON specification. In practice I don't think it matters. However, shoudl our default be to generate standard compliant (prettyPrint=true) or working/smaller output?

comment:6 Changed 11 years ago by Adam Peller

json.org only seems to state that whitespace "can" be inserted between tokens, so I think we're okay making this optional, unless I'm missing something. Seems like there's value encouraging saving space by default, and a third option just introduces more API complexity.

comment:7 Changed 11 years ago by Dustin Machi

I'm fine with that, its only a comment...especially if spaces are in fact allowed according to spec. I bring it up only because it used to not have the space in there and then it was changed to have it :P

Note: See TracTickets for help on using tickets.