JSON Data Parsing


Mark Stow
Hi David, Do you have any sample of parsing json data from a server? i.e user logs in on app and then the app receives json data containing account information. I have a server up and running and i can get the app the receives the data i just cant work out how to put the data into variables Thanks for you time

DecSoft

Hello Mark,

Yes; don't worry, because, it's quite easy. So once you get working one time... you know what to do in next similar situations. May I can provide a sample app in the near future, however, I think you can got it also if I refer here the steps.

First of all, prepare a server's script, in the below case a PHP one, which returns some JSON object to our app, when it's called:

Use an HTTP control, and, set his "Url" property to the URL of the above script, for example: "https://www.mydomain.com/myscript.php".

Then use the "execute()" method of the HTTP control to made the HTTP call. And finally look at the most interesting part: in the Done event of the HTTP control, you can access the JSON object using the HTTP control "response" property:

So, as you can see, can't be more easy: the HTTP control "response" is the JSON object that the script / server returns, and we can just access that JSON object properties like any other JavaScript property, like you can see above.

Please, take your time and try to prepare a sample app based in the above information: if you need some help at some point, just post it here and we will try to help you. :-)



DecSoft

Hello Mark,

Just for your information, there is a new sample app named "GetJson" included in the current release of DecSoft App Builder. Please, take a look and don't hesitate to post here if you have any further question.



Mark Stow
Hi David, Thank you for the reply, that has helped me a lot. Thank you

DecSoft

Hello Mark,

No problem! Glad to help! :-)


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.