How i can get id from json

Can anyone help me, I am new in thunkable, The JSON response code is

{
    "status": "success",
    "data": {
        "mailbox": "qsirrsr8460@site.com",
        "messages": [
            {
                "subject": "test 2",
                "is_seen": false,
                "from": "Ramos Kelly",
                "from_email": "ramoskelaly@gmail.com",
                "receivedAt": "2022-12-02 20:50:53",
                "id": "x6zQW58YB0oPoqewykXdo32S",
                "attachments": [],
                "content": "content html or text "
            },
            {
                "subject": "subject",
                "is_seen": true,
                "from": "Diaz",
                "from_email": "diaz202@gmail.com",
                "receivedAt": "2022-12-02 20:50:33",
                "id": "286J5Nvyk047VZORpBwGPzoQ",
                "attachments": [
                    {
                        "file": "file.png",
                        "url": "http://site.com/download/286J5Nvyk047VZORpBwGPzoQ/file.png"
                    }
                ],
                "content": "content html or text"
            }
        ]
    }
}

I want to get “id” from JSON and display it in text input 2, I tried this but it is not working

Hi imtiazalizour12193hp, welcome to Thunkable! :tada:

Be sure to check out How to ask Great Questions v2.0, the Community Guidelines, and our Getting Started Guide to make the best of your Thunkable Community experience!

Please check out this great tutorial on parsing data from JSON by Tatian. I think you will find it very helpful.

I recommend you use https://jsonpathfinder.com/ to find the path of the property.
Click on Sample, then paste your JSON code in. Then select on the right:

So in this example, id for the first entry comes up as:
x.data.messages[0].id
which in thunkable translates to: data.messages[1].id
as thunkable indexes from 1 not 0

the second entry would then have property of: data.messages[2].id

1 Like