Module:JSON data/documentation

This module is intended to be used by bots or other automation tools which need to access Wiktionary data. This is not a general-purpose JSON serialisation module. Using one would be impractical, as experiments have shown that using one on the language data easily hits execution limits.

Bots may access the data by using mw:API:Expandtemplates or requesting the raw source of a page invoking this module with a  query parameter.

Make sure you only load this module once (or twice, if you need both the languages table and another table). As of 11th of September 2013, the JSON for the languages table has been measured to weigh 666543 bytes. (Family data takes 13731 bytes, while scripts take 6279 bytes.) Generating the JSON data takes a few seconds and puts a relatively high strain on the servers.

Available functions are:,   and  , which generate the JSON equivalents of Module: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  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 values,   and   can be passed. For example, invoking the function with  ,   and   as 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).

Examples: This will return the ancestors and language family for every language. (See Template:language data documentation for an explanation of numbers  to  .) This will return all available info for two-letter language codes. (Note, this is currently broken and returns a Lua error.)