You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org> on 2008/02/29 20:48:51 UTC

[jira] Commented: (TAPESTRY-2211) JSONObject should render useing single quotes so that double quotes don't have to be escaped

    [ https://issues.apache.org/jira/browse/TAPESTRY-2211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573926#action_12573926 ] 

Howard M. Lewis Ship commented on TAPESTRY-2211:
------------------------------------------------

Perhaps Tapestry should change to render all attributes in single quotes?

> JSONObject should render useing single quotes so that double quotes don't have to be escaped
> --------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2211
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2211
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0.10
>            Reporter: Howard M. Lewis Ship
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org