Extract Array from JSON Object and Apply it in Extension Argument (Variable)

I created an extension that fetches data from the server, the retrieved data looks like this:

{
  "data": [
    {
      "id": 1,
      "name": "Afghanistan"
    },
    {
      "id": 2,
      "name": "Albania"
    },
    {
      "id": 3,
      "name": "Algeria"
    }
  ],
  "status": 200,
  "statusText": "OK"
}

The response is stored in data.
I want to set the array in data to a variable (argument in extension), the extension use JavaScript events.

Sounds like you need “Convert JSON to variable”?

Yes…
You actually gave me an idea… I’ll try and come back.
But still… I want answers.

That was the answer, I think… there is an action “Convert JSON to Variable” (or object variable). Does exactly what it says it does :stuck_out_tongue:

Unless I am misunderstanding what you need?

I use JavaScript events.
However, I found fromJSON on docs.gdevelop.io.