Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-1836

Output of JSON containing backslashes leads to broken JSON

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Major
    • None
    • 11.10.2
    • Velocity
    • None
    • Unknown

    Description

      Reproduction steps:

      • Create a page with the following content:
        {{velocity}}
        #if($request.outputSyntax == "plain")
          $response.setContentType('application/json')
        #end
        $jsontool.serialize("Something with \ backslash")
        {{/velocity}}
        
      • Open the page in get mode with ?outputSyntax=plain

      Expected result:

      • You see "Something with \ backslash" in get mode and the obtained JSON is valid

      Obtained result:

      • Instead of the "\" you see a line return, and the JSON is marked as invalid because of it

      Note: I tried using "\" and

      \\ 
      

      without any change on the resulted JSON validity.

      Attachments

        Activity

          People

            surli Simon Urli
            surli Simon Urli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: