Tapestry 5
  1. Tapestry 5
  2. TAP5-100

When rendering a partial markup response, Tapestry should quote attributes with single quotes (so that each quote doesn't have to be escaped in the JSON)

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.1.0.0
    • Component/s: None
    • Labels:
      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.

        Activity

        Hide
        Howard M. Lewis Ship added a comment - - edited

        JSON spec is very clear that attributes are quoted using double quotes.

        Tapestry could adapt and use single quotes for attributes in the markup; this would simplify the markup in the JSON response, and reduce its overall size.

        Show
        Howard M. Lewis Ship added a comment - - edited JSON spec is very clear that attributes are quoted using double quotes. Tapestry could adapt and use single quotes for attributes in the markup; this would simplify the markup in the JSON response, and reduce its overall size.
        Hide
        Howard M. Lewis Ship added a comment -

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

        Show
        Howard M. Lewis Ship added a comment - Perhaps Tapestry should change to render all attributes in single quotes?

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development