[Mediawiki-api] Inconstistent formatting of results in JSON

Jools Smyth buzz at exotica.org.uk
Tue Aug 19 02:55:15 UTC 2008


I'm having some problems which are caused by some inconsistent formatting
of results from the API in format JSON. This is making problems for a perl
module I made.

Take this example:

http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmsort=timestamp&cmdir=desc&format=jsonfm

results are returned in an array and so are easy to loop through. This is
how most of the results are formatted from the "list" query types.

now take this one:

http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Main%20Page&bllimit=5&blfilterredir=redirects&format=jsonfm

the results are not in an array but a hashref of hashrefs with the pageid
being the key (and the page id is also in the hashref too)

Is this a bug, or could this be changed so that the api returns results in
a consistent manner (as with the XML).

Best Regards

Jools




More information about the Mediawiki-api mailing list