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

edit

The Wikibase data model has a canonical representation in JSON, which is used by:

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

edit
Name 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

edit

The 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 }

format=json, format=xml

Libraries for Query Results JSON

edit
Name Language
sparesults Rust

See also the libraries listed on Tools/For programmers, that support the WDQS.