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. >
