Module:JSON data/documentation
This module is intended to be used by bots or other automation tools which need to access Wiktionary data.
Bots may access the data by using mw:API:Expandtemplates or requesting the raw source of a page invoking this module with a &templates=expand query parameter.
Available functions are: export_languages, export_etymology_languages, export_scripts and export_families, which generate the JSON equivalents of Module:languages, Module:etymology languages, Module:scripts and Module:families respectively. The structure of the data corresponds exactly to the one used in Wiktionary modules, with a caveat below.
When export_languages is given positional arguments:
The first specifies the types of languages (see Template:language data documentation) that will be listed in the data. The special valuesThis functionality has been broken for a long time. Omit the first parameter.TWO_LETTER,TWO_THREE_LETTERandTWO_THREE_LETTER_REGULARcan be passed. For example, invoking the function withTWO_LETTER,1and4as arguments will export the canonical names and script codes for languages with two-letter codes.- The following arguments list data keys which will be exported. To conserve space, if only one key is specified, its value is listed directly in the root object (indexed by language codes).
Example:
{{#invoke:JSON data|export_languages||ancestors|3}}
This will return the ancestors and language family for every language. (See Template:language data documentation for an explanation of numbers 1 to 4.)
Other examples:
{{#invoke:JSON data|export_etymology_languages}}
{{#invoke:JSON data|export_scripts}}
{{#invoke:JSON data|export_families}}
As a human (non-bot) you can try these out in the web UI via Special:ExpandTemplates.