Ovo je dokumentaciona podstranica za Модул:JSON data

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 &templates=expand 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: export_languages, export_scripts and export_families, 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 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 values TWO_LETTER, TWO_THREE_LETTER and TWO_THREE_LETTER_REGULAR can be passed. For example, invoking the function with TWO_LETTER, 1 and 4 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:

{{#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.)

{{#invoke:JSON data|export_languages|TWO_LETTER}}

This will return all available info for two-letter language codes. (Note, this is currently broken and returns a Lua error.)