Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
5.0.15
-
None
-
None
Description
When JSON output is sent to the client, it escapes each double quote with a backslash character.
Most of the Tapestry code and typical markup uses double quotes, so there's a lot of characters to escape, which not only increases the size of the output, but makes it less readable.
Example:
{"script":"Tapestry.initializeZones([], [[\"form:11866b5b0ae\",\"output\"],[\"clear:11866b5b0ae\",\"output
\"]]);Tapestry.registerValidation({\"password:11866b5b0ae\":[[\"required\",\"You must provide a value
for Password.\"],[\"minlength\",\"You must provide at least 6 characters for Password.\",6]],\"birthYear
:11866b5b0ae\":[[\"required\",\"You must provide a value for Birth Year.\"],[\"min\",\"Birth Year requires
a value of at least 1900. \",1900],[\"max\",\"Birth Year requires a value no larger than 2007.\",2007
]],\"firstName:11866b5b0ae\":[[\"required\",\"You must provide a value for First Name.\"],[\"minlength
\",\"You must provide at least 3 characters for First Name.\",3]],\"lastName:11866b5b0ae\":[[\"required
Using single quotes around JSON Object keys and values would make this a lot more readable, as only the occasional single quote would need to be backslash escaped.
Hm. The official JSON spec (http://www.json.org/) seems to indicate that strings must be quoted with double quotes.