Page MenuHomePhabricator

[SMW] [ROADMAP] [CLOSED] Improve JSON format
Closed, ResolvedPublic


This request is used to track the roadmap point


The JSON format currently manually encodes the data, causing many inconsistencies and bugs (and historically had security issues as well, which might not all be gone). It would be a lot better to create the data structure using php arrays and then serializing it using FormatJSON::encode or json_encode.




Not defined

See also

[1] includes/queryprinters/SMW_QP_JSONlink
[2] includes/SMW_DISerializer

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:22 AM
bzimport set Reference to bz37418.
Unknown Object (User) added a comment.Jun 9 2012, 12:25 PM

Maybe JSON-LD[1] (JavaScript Object Notation for Linking Data) should be considered as well.


Unknown Object (User) added a comment.Jul 5 2012, 6:26 PM


  • SMW_QP_JSONlink will use SMWDISerializer::getSerializedQueryResult in order to unify with existing methods.
  • FormatJSON::encode will encode the array
  • JavaScript can parse the json string back into its original array using (typeof json == 'string' ? data = JSON.parse( json ) : data = json;)

JSON Structure

-> printrequests:

[ { label, typeid, mode} ]

-> results:

{ subject : {printouts: { ["property":[{fulltext:"", fullurl:""}] ] } } }
Unknown Object (User) added a comment.Jul 5 2012, 6:52 PM

On the contrary to the previous implementation, the new JSON output does not manipulate the date format and export any date in its original format (time stamp)

Unknown Object (User) added a comment.Jul 5 2012, 7:54 PM

The export structure [1] has been changed.


Unknown Object (User) added a comment.Jul 6 2012, 5:07 PM
  • obsolete -> getObsoleteJSON can be used for compatibility but will be @deprecated in 1.10
  • simplified -> getSimplifiedJSON based on SMWDISerializer but with a

simplified array structure

  • complete -> getCompleteJSON based on SMWDISerializer produces the full JSON object