parse json data

30 views
Skip to first unread message

Peter Pfeiffer

unread,
Aug 3, 2026, 2:49:16 AM (10 days ago) Aug 3
to Automate for Android
Hi,

sorry for asking but I didn't get it how to parse data from a json response from a API.
I found several flows and study them but I didn't get the point.
The Data I got from web which I will analyze are stored in myResponse variable:

{
"ok": true,
"license": "CC BY 4.0 - https://creativecommons.tankerkoenig.de",
"data": "MTS-K",
"status": "ok",
"stations": [
{
"id": "087bc6cf-fd2d-417a-98ad-725c51a6e6af",
"name": "Kuster Energy",
"brand": "Kuster Energy",
"street": "Bahnhofstraße",
"place": "Voerde",
"lat": 51.60319,
"lng": 6.70303,
"dist": 0,
"price": 2.199,
"isOpen": true,
"houseNumber": "159",
"postCode": 46562
},
{
"id": "ee5fa84f-e7e0-4e0a-a95a-bf2691e06ba0",
"name": "Aral Tankstelle",
"brand": "ARAL",
"street": "Bahnhofstraße",
"place": "Voerde",
"lat": 51.60073,
"lng": 6.697079,
"dist": 0.5,
"price": 2.199,
"isOpen": true,
"houseNumber": "139",
"postCode": 46562
}
]
}

I use jsonDecode(myResponse)["stations"]  and get the stations only - but I can't get the name of the station for example by using jsonDecode(myResponse)["stations"]["name"] of the single sets of data

So it would be nice is someone can give me a helping hand to understand what I have to do now. 

Kind Regards 
Peter

Henrik "The Developer" Lindqvist

unread,
Aug 3, 2026, 7:53:33 AM (10 days ago) Aug 3
to Automate for Android
"stations" is an array so to get the "name" of the first element would be:
jsonDecode(myResponse)["stations"][0]["name"]

Peter Pfeiffer

unread,
Aug 3, 2026, 8:17:16 AM (10 days ago) Aug 3
to Automate for Android
Hi Henrik,
thank you for the fast answer. It's working fine!

In the meanwhile I did it with 
For Each in jsonDecode(MyResponse)["stations"]
than I set entry value to "val" and get the "name" with val["name"] and loop through all entries.

Thank you very much for your help and for Automate!
Br
Peter
Reply all
Reply to author
Forward
0 new messages