How can i get data from json to spinner

Dear All
this is not the first time i post a topic for learning json and still i need your support and help
i need to set a spinner for sector
and another one for site all data at one json
i need support
https://asdc-hrq.com/json/user_mobile_check.php?id=156

Is this related to your previous topic. You are pointing to the same website?

hello peter
thanks for fast replay my json different not as last topic could you please take a look

This Json is yours Response Content. Use a list to receive the web.decode text + Response Content block (within the web.got event). Then use the lookup pairs block to take the values ​​and put them in another list. Use this list to spinner

4 Likes

{“daily”:{“data”:[{“sector”:“الاسكندرية 1”}]},“daily2”:{“data2”:[{“site”:“غبور معرض قطع غيار صلاح الدين”},{“site”:“غبور معرض الغرفة التجارية”},{“site”:“غبور معرض السيارات الرمل”},{“site”:“غبور مالتي براند سموحة”},{“site”:“غبور جراج سيارات رجب”},{“site”:“غبور مبني درايف رشدي”},{“site”:“غبور معرض قطع غيار ميامي”},{“site”:“غبور مركز خدمة مرغم”},{“site”:“غبور معرض هيونداي دمنهور”},{“site”:“بنك عربي فرع الرمل”},{“site”:“بنك عربي فرع سموحة”}]}}

test1.aia (4.7 КБ)

2 Likes

thank you for your support and help
when i use the same blocks i faced
Value of type java.lang.String cannot be converted to JSONObject
https://asdc-hrq.com/json/user_mobile_check.php?id=176
data json not include the style value


{
“daily”: {
“data”: [
{
“sector”: “التجمع 1”
},
{
“sector”: “التجمع 2”
},
{
“sector”: “الرحاب”
},
{
“sector”: “بدر والعاشر”
},
{
“sector”: “أكتوبر”
},
{
“sector”: “البنوك”
},
{
“sector”: “وسط القاهرة”
}
]
},
“daily2”: {
“data2”: [
{
“site”: “بالم 4”
},
{
“site”: “قطامية بلازا”
},
{
“site”: “ايباكو مول”
},
{
“site”: “ماونتن فيو 1”
},
{
“site”: “السوق الشرقي”
},
{
“site”: “افينو مول”
}
]
}
}

test2 (1).aia (4.8 КБ)

You can try using the block :
( and so learn …just a suggestion)

keypath
+
makelist
+
stringname
+
foreach
+
lookuppairs2

One question: Will your Json always be like this?

date, date2, date3, date4, date5 …
daily, daily2, daily3, daily4, daily5…

not at all i need to learn how can i read json at any level

Then read this guide

Also use a json formater and validator like https://jsonparseronline.com/ that helps you understand if your json contains arrays, objects and the structure of your json

1 Like