Last modified: 2012-07-05 19:53:22 UTC
Quotation mark in page title produces wrong JSON export E.g., a page with the title: Limits of self-organization: peer production and "laws of quality" See an example here: http://sandbox.semantic-mediawiki.org/wiki/Limits_of_self-organization:_peer_production_and_%22laws_of_quality%22 With content [[title::Limits of self-organization: peer production and "laws of quality"]] [[author::Paul Duguid]] {{#ask: [[author::Paul Duguid]] |? title |? author | format = JSON }} the formatted JSON will not escape the quotation mark in the page title: "items": [ { "label": "Limits of self-organization: peer production and "laws of quality"", "title": ["Limits of self-organization: peer production and "laws of quality""], "author": ["Paul Duguid"] } ] } Another example: http://wikilit.referata.com/wiki/Special:Ask/-5B-5BCategory:Publications-5D-5D-20-5B-5Bhas-20author::Paul-20Duguid-5D-5D/-3FHas-20author/-3FYear/-3FAbstract/-3FDomain/-3FHas-20topic/limit%3D50/searchlabel%3D/format%3Djson
Thanks for the report. I'm utterly unsurprised by this issue, and have written up a proposal to rewrite this result format here: http://semantic-mediawiki.org/wiki/Roadmap#Improve_JSON_format
Thanks for the quick reply and the links. Unless an entire rewrite is done, I guess there is a "FormatJson::encode" missing in line 66. https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=blob;f=includes/queryprinters/SMW_QP_JSONlink.php;hb=HEAD I suppose there could also be an issue with the properties (lines 48 and 50): Its value and type. I dont know whether SMW accepts a quotation character in the property and its type, though, but wouldn't it be safer to add encoding there too?
This problem is solved with the new JSON export but please be aware that the JSON structure will change beginning with the deployment of (bug 37418). [1] http://www.semantic-mediawiki.org/wiki/Help:JSON_format#Structure