Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.
Dickson Law edited this page Sep 7, 2017 · 1 revision

Top-Level Constructors

JsonData(top_structure)

Denotes a JSON nested data structure, headed by the given top structure (should be JsonMap(...), JsonList(...) or JsonArray(array)). This represents an actual data structure ID and should be the final value stored in variables.

Example:

my_json = JsonData(
  JsonMap(
    "a", 5,
    "b", 7
  )
);
show_debug_message(json_encode(my_json)); //{"a": 5, "b": 7}

Subsidiary Constructors

JsonArray(array)

Convert the array and all nested arrays into JSON arrays. 1D arrays are converted into simple JSON arrays, 2D arrays are converted into 2-level JSON arrays in row-major order. Use this only within JsonData(...), JsonList(...) or JsonMap(...). Do not nest JsonData(...), JsonList(...) or JsonMap(...) within the array being converted.

Example:

hiscore_array = Array(992, 581, 317, 226, 102);
hiscore_data = JsonData(
  JsonMap(
    "last_updated", "2017-09-07 14:14:14",
    "data", JsonArray(hiscore_array)
  )
);

JsonList(...)

Denotes a JSON array with the given key-value pairs. Use this only within JsonData(...), JsonList(...) or JsonMap(...).

Example:

hiscore_data = JsonData(
  JsonMap(
    "last_updated", "2017-09-07 14:14:14",
    "data", JsonList(
      992, 581, 317, 226, 102
    )
  )
);

JsonMap(...<key, value>...)

Denotes a JSON object with the given key-value pairs. Use this only within JsonData(...), JsonList(...) or JsonMap(...).

Example:

player = JsonData(
  JsonMap(
    "name", "Alice Anderson",
    "age", 32
  )
);

Clone this wiki locally