Hi guys i am still playing with the JSON library and need some help, i think i am close but i cant see what needs to be done. the little i have created is below:
i can get each realm into a list but then cant get the information in the list unless i use substring looking for the field i want, i believe i should be able to get each realm into a different map. for this server there are 266 realms, i have used JSON Online Viewer to look at the data just open the link and click on 'Load JSON Data' and paste http://eu.battle.net/api/wow/realm/status into the box, and you can see the data.
This viewer puts the data it realm, i created a map and tried to put the data into realms map but i had an error as is said i can not use a map, so i changed it to a list and this allowed the data to be inserted, but it isn't much use,
the JSON Structure can be seen in the image i have attached, there are 266 realms following the same structure format.
Does anyone have a way forward.
Thanks
Stu
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim RealmData As Map
Dim Realms As List
Dim EUrealms As Map
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Get_Realm_Data
EUrealms.Initialize
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Get_Realm_Data
Dim RealmStatus As HttpJob, Server As String
Server = "http://eu.battle.net/api/wow/realm/status"
RealmStatus.Initialize("RealmStatus",Me)
RealmStatus.Download(Server)
End Sub
Sub JobDone (Job As HttpJob)
Dim JSON,JSON1 As JSONParser
If Job.Success = True Then
Select Job.JobName
Case "RealmStatus"
JSON.Initialize(Job.GetString)
Log(Job.GetString)
RealmData = JSON.NextObject
Realms = RealmData.get("realms")
Log(RealmData)
Log(Realms)
For a=0 To Realms.Size-1
EUrealms.Put(a,Realms.Get(a))
Next
Log(EUrealms.Get(1))
Log(Realms.Size)
End Select
End If
Job.Release
End Sub
i can get each realm into a list but then cant get the information in the list unless i use substring looking for the field i want, i believe i should be able to get each realm into a different map. for this server there are 266 realms, i have used JSON Online Viewer to look at the data just open the link and click on 'Load JSON Data' and paste http://eu.battle.net/api/wow/realm/status into the box, and you can see the data.
This viewer puts the data it realm, i created a map and tried to put the data into realms map but i had an error as is said i can not use a map, so i changed it to a list and this allowed the data to be inserted, but it isn't much use,
the JSON Structure can be seen in the image i have attached, there are 266 realms following the same structure format.
Does anyone have a way forward.
Thanks
Stu