ApiJson

Family: Studio · One form

What it does

Reads one field of an API task's JSON answer, by a dotted path such as user.name or items.0.id.

Syntax

ApiJson(tache integer, cle string) → string

Parameters

NameTypeMeaning
tacheintegerThe task id returned by ApiRequest().
clestringThe dotted path to the field. Array items are reached by their index, from 0. An empty path returns the whole answer.

Every form returns

string

The field as text: numbers and true/false become text, and an object or array comes back as JSON. An empty string when the body is not JSON or the path leads nowhere.

Good to know

  • Because objects come back as JSON, the result can be read again with a second, shorter path.
  • Editor and HTML5 exports only: native (Bevy) builds stop with an unsupported-command error.

Example · generated

DO  Print(ApiJson(1, "value"))  Sync()LOOP

ApiJson is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

133 commands in Studio