Page MenuHomePhabricator

SMW_QP_JSONlink.php throwing errors and not creating valid JSON
Closed, ResolvedPublic

Description

Author: neiladavies

Description:
Fixes bug

JSON query result renderer under certain circumstances fails and always produces invalid JSON
Its invalid as the keys are not always enclosed within quotes
If the query is for a specific page and is requesting values of that page then it generates an error

Patch that fixes these issues is attached


Version: unspecified
Severity: major

Attached:

Details

Reference
bz20241

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:49 PM
bzimport set Reference to bz20241.

See also my comment on the devel list regarding the problems with valid JSON:

http://sourceforge.net/mailarchive/message.php?msg_name=200908141759.41407.markus%40semantic-mediawiki.org

Reassigning to Fabian for check.

fh wrote:

It is about time that the JSON exporter delivers valid JSON.
The patch can be applied without affecting the compatibility with Exhibit now.

Rather than patching the code to construct json in a raw string based way, which most likely will have issues when it comes to unicode (normally those are supposed to be encoded using \u's iirc) why not tweak the code instead to use a proper json encoder. The API already has a method for json encoding.

fh wrote:

Indeed the use of existing JSON encoding functions is feasible now. I am going to modify the code accordingly as soon as I find time.

This change could now be applied, but the respective code has changed and the patch no longer matches. It would be helpful if a patch for the current version could be supplied.