Json array to spinner

Hi there, it's first time for me and I want to thanks who can help me.
I'm approaching for first time to MIT App from Visual Studio, and I should want to create an app that read data from an access db and charge them on a spinner.
So I have created a php file to connect via odbc to my access db and it functions perfectly, so we have to pass to the app.
I have created a simply screen in which I have a web control, a label and a spinner.
When I connect I obtain the full list like this
array(1336) {
[1]=>
string(10) "First Name"
[2]=>
string(11) "Second Name"
[3]=> etc

I'm not able to extract from Array the ID and Name to charge on spinner to using successively.
Someone can help me?

Where is the ID and where is the name? What should the spinner data look like? Show a longer example of data, preferably copied after reading from the server, because the details can matter. Also show an example of how it should look like in a spinner.
Is Id [1], [2] etc? And name is "First name", "Second name" etc?

It should look like this in the spinner?
[1] First name
[2] Second name

See JSON for the JSON standard.

The text you posted is not JSON.

Thanks for your answer, the spinner shoud have only name, eg.
First Name
Second Name
once I select the name, the index (1,2...etc) should be used to identify the unic name.

Thanks, i have tryed to change the array string in this way
[{"userId":1,"nome":"pippo"},{"userId":2,"nome":"pipppo"},{"userId":3,"nome":"pio"}]

but i get this error
Lookup in pairs: the list [{"nome":"pippo","userId":1}, {"nome":"pipppo","userId":2}, {"nome":"pio","userId":3}] is not a well-formed list of pairs

Using this format, I don't get the error, so I think that is the right format, although I don't see nothing else!

{"clienti":[{"ID":1,"nome":"pippo"},{"ID":2,"nome":"pipppo"},{"ID":3,"nome":"pio"}]}

So, based on ABG's suggestion, I modified the structure of the JSON string getting the array in the box without errors. The thing is, I have no idea how to accomplish what I need, which is to load names into the spinner and if I select a name, collect the associated ID.

Something like this:

Absolutely amazing! It's what I wanted to get and that I can adapt to my needs. However I'm trying to figure out how to transfer the array that comes from the Web1 call, because in your example you have preconfigured the array with a ready list, in fact, as you can see, I had inserted the Web1.Got text block
should I assign the responsecontent to your json variable?

Just use the responseContent if the data is coming back in the same format as you/I showed in the json variable.

That's exactly what I did. I add the result for those who have the same problem as me. Thank you very much for the support, I have read several of your posts and they are always helpful.

The preferred prefix or suffix for a dictionary data type is dict, not str.

Search this board for
FAQ JSON

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.