Last modified: 2012-07-06 17:08:35 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39418, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37418 - [SMW] [ROADMAP] [CLOSED] Improve JSON format
[SMW] [ROADMAP] [CLOSED] Improve JSON format
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: MWJames
:
Depends on:
Blocks: 23946 34783 36438
  Show dependency treegraph
 
Reported: 2012-06-09 12:24 UTC by MWJames
Modified: 2012-07-06 17:08 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description MWJames 2012-06-09 12:24:11 UTC
This request is used to track the roadmap point

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

## Package
SMW

## Release
Not defined 

## See also 
[1] includes/queryprinters/SMW_QP_JSONlink
[2] includes/SMW_DISerializer
Comment 1 MWJames 2012-06-09 12:25:21 UTC
Maybe JSON-LD[1] (JavaScript Object Notation for Linking Data) should be considered as well.

[1] http://json-ld.org/
Comment 2 MWJames 2012-07-05 18:26:35 UTC
## Description

- 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:""}] ] } } }
Comment 3 MWJames 2012-07-05 18:52:39 UTC
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)
Comment 4 MWJames 2012-07-05 18:52:53 UTC
https://gerrit.wikimedia.org/r/#/c/14347/
Comment 5 MWJames 2012-07-05 19:54:43 UTC
The export structure [1] has been changed.

[1] http://www.semantic-mediawiki.org/wiki/Help:JSON_format#Structure
Comment 6 MWJames 2012-07-06 17:07:50 UTC
- 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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links