Get object from json

Hi now i am working on my new app for eye disease detection by using Api when i make request by sending image to my pre prepared ai for eye disease detection by using Api i get answers in the following form


but i want it to be displayed in this form

how can i do it

Youโ€™ll need to parse the JSON into variables - if you do a search for it on the forum, thereโ€™re plenty of examples. It does take a while to get your head round though.

Hereโ€™s an example from one of my projects. The key bit is the two orange blocks at the bottom - theyโ€™re assigning a value from the JSON into a variable (var2). Thereโ€™s a list in your API return, so watch for that.

To reference the first probability, youโ€™ll need to reference โ€˜disease_prediction[1].probabilityโ€™, the first TagID will be โ€˜diseae_prediction[1].TagIDโ€™ and so on.

1 Like

Thanks, it has helped but there is one thing i need help how can i create a table to display the results in my app and also get the probability and tag name together i order to show them in a same row in a table without confusing them with as tags lastly how can i get them arranged in order that the tag with high probability appear the first.

I guess if youโ€™re displaying only one result at a time, you could build a screen with labels and line them up that way. If youโ€™ve got more than one result, then youโ€™re probably looking at some sort of Data Viewer List which will make things a lot more complicated. Instead of just returning the variables, you would then need to put them into a data source and pull them from there. Sorting data is, as Iโ€™m also struggling with, pretty complicated.

wow but thanks for the answer you have given me.

1 Like

Does anyone have got solution for the question i have asked in the first post in this chat?

Did the solution above not work?

If you need help with JSON, itโ€™s important that you post the full response as text and make sure to format it using the </> button in the toolbar above the post. To learn more about JSON parsing from an API, you can view my tutorial (link below).

ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
Need help? How to Ask Great Questions :sparkles: Debugging A Project :sparkles: API JSON Tutorial

Want to hire a Certified Thunkable Expert? Elevate your app with Tatiang on Fiverr

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