Page MenuHomePhabricator

Wikibase API should use the modern JSON syntax in API response on formatversion=2
Open, Needs TriagePublic

Description

Current result on https://www.wikidata.org/w/api.php?format=json&formatversion=1&action=wbgetentities&sites=dewiki&titles=This+title+does+not+exist+%C3%A4%C3%B6%C3%BC

{"entities":{"-1":{"site":"dewiki","title":"This title does not exist \u00e4\u00f6\u00fc","missing":""}},"success":1}

Current result on https://www.wikidata.org/w/api.php?format=json&formatversion=2&action=wbgetentities&sites=dewiki&titles=This+title+does+not+exist+%C3%A4%C3%B6%C3%BC

{"entities":{"-1":{"site":"dewiki","title":"This title does not exist äöü","missing":""}},"success":1}

formatversion=2 uses the UTF-8 encoding instead of the JSON string escaping for Unicode characters but not the modern JSON syntax like "missing":true instead of "missing":"".

Compare the core API changes from formatversion=1 https://www.wikidata.org/w/api.php?format=json&formatversion=1&action=query&titles=This+title+does+not+exist+%C3%A4%C3%B6%C3%BC

{"batchcomplete":"","query":{"pages":{"-1":{"ns":0,"title":"This title does not exist \u00e4\u00f6\u00fc","missing":""}}}}

to formatversion=2 https://www.wikidata.org/w/api.php?format=json&formatversion=2&action=query&titles=This+title+does+not+exist+%C3%A4%C3%B6%C3%BC

{"batchcomplete":true,"query":{"pages":[{"ns":0,"title":"This title does not exist äöü","missing":true}]}}