Help me to finish this JSON Code

Hello everyone, hope you doing great.
I am newbie here, i started a code but i can’t go further.
Here is the issue i want to get JSON text from the site to my app in ListView or Textbox by just pressing a button.

This is my JSON code that i want to be shown on my app.
code json

Or here is the link
https://day-dream.000webhostapp.com/index.json
Raw style:
{“result”:{“Name”:“Jeff A.”,“Phone”:17885555435,“Gender”:“Male”,“RegDATE”:“02/06/2020”,“Level”:{“status”:“Moderator”,“level”:“30”,“value”:2},“Email”:“jeff*****@gmail.com”,“Active”:1},“time”:“06/15/2020 - 04:35:13.584”}

here is my MIT app Inventor code:

With this code when i get data in my app all the json text appears on textbox like this: {“result”:{“Name”:Jeff. A,“Phone”:17885555**,*“Ge…, i don’t want to appear all the text
i want to show in my text box only: Name, Gender, Phone, and Email
like this

Name: Jeff A.
Gender: Male
Phone: 01290129102
Email: Jeff***@gmail.com*

Like this i want to be shown on my Textbox1
please help me.

First of all, it would have been nice if you would have posted proper json. I made this out of it:
{ “result”: { “Name”: “Jeff.A”, “Phone”: 17885555, “Gender”: “Male”, “RegDATE”: “02/06/2020”, “Level”: { “status”: “Moderator”, “level”: “30”, “value”: 2 }, “Email”: “Jeff*****@gmail.com”, “time”: “06/15/2020 - 04: 35: 13.584” } }
I used a dictionary to decode your json, and as a start, I came up with this:


Here is also the .aia
jsonA.aia (2.5 KB)
For you to complete it as necessary.
Cheers, Ghica.

2 Likes

thanks for the correction but i copied from the url as u saw it, please i am lost here where i should add my Json Url?

Make a global variable called resultDict.
Do your JSON decode, and set global resultDict to the value under key "result" .

Code a procedure names ADD_Key with a parameter named myKey:
set Label1.Text to JOIN('\n', myKey, ':', (get value for key myKey in dictionary resultDict)

call ADD_Key('Name')
call ADD_Key('Gender')
call ADD_Key('Phone')
call ADD_Key('Email')
1 Like

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