Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-184

EscapeTool: add a json method, or a javascript method with a second parameter

    XMLWordPrintableJSON

    Details

      Description

      The string returned by EscapeTool.javascript() method is not alway compliant with the JSON syntax. For instance, when the input string contains an apostrophe ', a backslash is inserted before it because there is no way for the method to know if the string is enclosed with single or double quotes. This is not compliant with the JSON syntax, and some JSON parsers will reject the string.

      There may be other differences between javascript and JSON strings, but this is the one I encountered, and I had to use a workaround.

      This issue can be solved either with a JSON method, or with a second javascript method with a second parameter indicating the type of quote used.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              robbyn Maurice Perry
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: