Page MenuHomePhabricator

MediaWiki API Sandbox uses jsonfm when format=json is specified
Open, Needs TriagePublic


I was just writing a blog post covering profiling of Wikibase and MediaWiki when I found an unexpected call to SyntaxHighlight in my API call.
It turns out that jsonfm is sent to the API even though the API sandbox shows json is selected.

The UI displays at format=json

image.png (549×621 px, 40 KB)

There are no differences between the formatted options and normal options

image.png (399×1 px, 44 KB)

In my opinion this is confusing and we should

  • Have a default in the API sandbox of jsonfm
  • Allow users to set non formatted versions, such as json

Event Timeline

The jsonfm is used to show a pretty printed json in the result. If the sandbox would use format=json there is only a one line json the result box, which seems very unhelpful for the human looking at the result.

But to avoid that machine used the jsonfm bit, the parameter shown and provided are the unformatted formats.

I would keep it and wontfix this for better user experience.

This seems live a bad developer experience to me, as this is a sandbox that does not allow you to use all features of the API.

I certainly have nothing against formatted output being the default for the sandbox, however I think this should be explicitly shown in the UI, and users should be able to set all format options the API provides if they want to.

This would have no behaviour change for most users of the sandbox, however would enable the usecase of easily making API calls using other formats.

When visiting there is a big disclaimer about the formatted output.

There is no disclaimer (about formatted output) on the sandbox on (after submitting the query), because it does not provide the formatted version to the user

The sandbox is there to help developer to build an api query (without looking at different pages for the parameter and to type the url), which could be copy into the script. If there is a difference between jsonfm and json, the developer could end up copying the jsonfm into the code. That is bad for the developer and also increased the used bandwidth and payload for the server.

In my opinion there is no need a developer has to choose between the formatted and non-formatted version when building a query in the sandbox, because the script/bot should not use the formatted query at any time.
It seems you are using the sandbox for different purpose/usecase, just use the plain browser to show results of the api when using plain json (

The more I look at it, the more confusing it becomes for the opposite reasons.

image.png (663×1 px, 63 KB)

But I do get the concerns of folks copying queries with jsonfm being undesirable.

Though I hope with some more thinking we could come up with some possible middle ground.