On Wed, Jul 6, 2011 at 7:36 AM, Justin Zhang <justinzh(a)teammersion.com> wrote:
Hi all,
First, thank you for viewing my post. I'm working on product to get information
from wiki and show them in office application. And when I am working with MediaWiki APIs,
I found a problem. I use C# to build my application and I get the query result from
MediaWiki by Json format. And my problem is that Some APIs will return a json object which
cannot be deserialized to a C# object.
For example, when I try to get the image list of Seattle,(the request url
is this) The result will be:
This image got scrubbed by the mailing list.
Please check the red box in the picture above. As
we know that JSON is a key/value based format and in the red box, this key is dynamically
generated according to the page id. in this way, this json is unable to be deserialized to
a C# object since I have to map a C# property to a const key/ID in code. I just wonder why
MediaWiki do this? if MediaWiki APIs wants to support to show multipage in query result,
probably it should use Array to show all page info?
--
Yes, JSON uses page IDs as keys. If this is inconvenient in your
language (as it is in JavaScript), you can set &indexpageids=1 and
you'll get an array of the page IDs used added to the result. That's
really the best I can do for you at this point; we did not and will
not design our output formats around the limitations of a specific C#
deserializer (JavaScript and PHP can work with this just fine, it's
really a limitation of your language or library).
Roan Kattouw (Catrope)