Wikidata:Data formats
The MediaWiki API and Special:EntityData support the #Wikibase JSON format, while the Wikidata query service supports the standardized #Query Results formats.
To test how specific data types are encoded in any given format you can use the Q115569934 data item.
See the Wikidata:Stable Interface Policy for the policy of which interfaces are considered stable.
Wikibase JSON
editThe Wikibase data model has a canonical representation in JSON, which is used by:
- Special:EntityData, when using JSON output, e.g. Special:EntityData/Q5.json
- the MediaWiki API, when using
format=json
, e.g. wbgetentities or wbsearchentities - JSON dumps
For help with deciding which of these mechanisms to use, see Wikidata:Data access.
See /JSON datatype encodings for an autogenerated page that displays how the individual datatypes are encoded in JSON.
Libraries for Wikibase JSON
editName | Language |
---|---|
Wikibase DataModel Serialization | PHP |
wikibase-types | TypeScript |
See also the libraries listed on Tools/For programmers, that support the Wikibase API.
Query Results formats
editThe Wikidata query service supports both the SPARQL 1.1 Query Results JSON Format, as well as the SPARQL Query Results XML Format.
You can test how individual datatypes are encoded with the following query:
SELECT ?prop ?value WHERE { wd:Q115569934 ?prop ?value . [] wikibase:directClaim ?prop }
Libraries for Query Results JSON
editName | Language |
---|---|
sparesults | Rust |
See also the libraries listed on Tools/For programmers, that support the WDQS.