You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2014/01/02 22:29:50 UTC

[jira] [Resolved] (WW-4041) JSONValidationInterceptor and quotes in message

     [ https://issues.apache.org/jira/browse/WW-4041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart resolved WW-4041.
-------------------------------

    Resolution: Fixed
      Assignee: Lukasz Lenart

Added usage of Lang3 3.2 and escapeJson instead of escapeEcmaScript - thanks [~maurizio.cucchiara]!

> JSONValidationInterceptor and quotes in message
> -----------------------------------------------
>
>                 Key: WW-4041
>                 URL: https://issues.apache.org/jira/browse/WW-4041
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JSON
>    Affects Versions: 2.3.14
>            Reporter: mael le guével
>            Assignee: Lukasz Lenart
>            Priority: Minor
>             Fix For: 2.3.17
>
>         Attachments: WW-4041-test.patch, string.gif
>
>
> Hello,
> There is a problem with org.apache.struts2.json.JSONValidationInterceptor
> This class is using StringEscapeUtils.escapeEcmaScript(String) to escape the generated JSON string.
> The problem is that StringEscapeUtils.escapeEcmaScript escapes the apostrophes. Some JSON implementations accept the escaped apostrophes but some other don't and they are not able to parse the JSON.
> I think there should be at least an option to disable apostrophe escaping. But as I believe escaping apostrophe is not part of the JSON specifications, the best would be to not allow apostrophe escaping.
> As an example, here is a JSON string generated by the JSON plugin :
> {code}
> {
>     "fieldErrors": {
>         "password": [
>             "Password isn\'t correct"
>         ]
>     }
> }
> {code}
> If you test it on http://jsonlint.com/, it says the syntax is incorrect.
> Thanks.
> See the original question on [the Struts User ML|http://goo.gl/WqM4f]



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)