You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "Wing Yung (JIRA)" <ji...@apache.org> on 2007/05/24 20:30:16 UTC

[jira] Created: (ABDERA-48) JSON Content Writing

JSON Content Writing
--------------------

                 Key: ABDERA-48
                 URL: https://issues.apache.org/jira/browse/ABDERA-48
             Project: Abdera
          Issue Type: Bug
            Reporter: Wing Yung
            Priority: Minor


The Abdera JSONWriter is adding an extra set of quotation marks around entry content values.

    	Entry e = abderaFactory.newEntry();
    	e.setContent("some content", Content.Type.TEXT);
    	JSONObject obj = JSONWriter.toJSON(e);

=> 

{ ... "content":{"value":"\"some content\"","type":"text"}," ... }

Around line 143 of org.apache.abdera.ext.json.JSONWriter:
jscontent.put("value", JSONObject.quote(content.getValue()));

The JSONObject.quote method adds the quotation marks (in addition to inserting '\'s into the content). A possible fix would be to strip the surrounding quotation marks off the output of JSONObject.quote since we'd still like it to escape special characters in the content.

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


Re: [jira] Created: (ABDERA-48) JSON Content Writing

Posted by James M Snell <ja...@gmail.com>.
I noticed that with the JSONObject.quote in there the content actually
ends up coming out double escaped.  Removing the call to quote
completely seems to produce the expected and appropriate result.

- James

Wing Yung (JIRA) wrote:
> JSON Content Writing
> --------------------
> 
>                  Key: ABDERA-48
>                  URL: https://issues.apache.org/jira/browse/ABDERA-48
>              Project: Abdera
>           Issue Type: Bug
>             Reporter: Wing Yung
>             Priority: Minor
> 
> 
> The Abdera JSONWriter is adding an extra set of quotation marks around entry content values.
> 
>     	Entry e = abderaFactory.newEntry();
>     	e.setContent("some content", Content.Type.TEXT);
>     	JSONObject obj = JSONWriter.toJSON(e);
> 
> => 
> 
> { ... "content":{"value":"\"some content\"","type":"text"}," ... }
> 
> Around line 143 of org.apache.abdera.ext.json.JSONWriter:
> jscontent.put("value", JSONObject.quote(content.getValue()));
> 
> The JSONObject.quote method adds the quotation marks (in addition to inserting '\'s into the content). A possible fix would be to strip the surrounding quotation marks off the output of JSONObject.quote since we'd still like it to escape special characters in the content.
> 

[jira] Resolved: (ABDERA-48) JSON Content Writing

Posted by "James M Snell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ABDERA-48?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James M Snell resolved ABDERA-48.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 0.3.0

Fix committed.

> JSON Content Writing
> --------------------
>
>                 Key: ABDERA-48
>                 URL: https://issues.apache.org/jira/browse/ABDERA-48
>             Project: Abdera
>          Issue Type: Bug
>            Reporter: Wing Yung
>            Priority: Minor
>             Fix For: 0.3.0
>
>
> The Abdera JSONWriter is adding an extra set of quotation marks around entry content values.
>     	Entry e = abderaFactory.newEntry();
>     	e.setContent("some content", Content.Type.TEXT);
>     	JSONObject obj = JSONWriter.toJSON(e);
> => 
> { ... "content":{"value":"\"some content\"","type":"text"}," ... }
> Around line 143 of org.apache.abdera.ext.json.JSONWriter:
> jscontent.put("value", JSONObject.quote(content.getValue()));
> The JSONObject.quote method adds the quotation marks (in addition to inserting '\'s into the content). A possible fix would be to strip the surrounding quotation marks off the output of JSONObject.quote since we'd still like it to escape special characters in the content.

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