normally if there is data return it would have a count value and then a list of data but I need to validate if there is no data, i.e. if count is zero, normally, I get the data using the following code because there is a count and I would get all the data from the results list but I can't find any examples that I can get the value of count
B4X:
Dim root As Map = parser.NextObject
Dim Count As Map = root.Get("count")
Dim results As List = root.Get("results")
Dim root As Map = parser.NextObject
Dim Count As String = root.Get("count")
If Count = 0 Then
Msgbox("No data exists for this account","No Data")
Else
Dim results As List = root.Get("results")
@Colin Evans have you searched the forum for JSON Tree???
B4X:
Dim parser As JSONParser
parser.Initialize("{"count":0,"next":null,"previous":null,"results":[]}")
Dim root As Map = parser.NextObject
Dim next As String = root.Get("next")
Dim previous As String = root.Get("previous")
Dim count As Int = root.Get("count")
Dim results As List = root.Get("results")
It's easy enough to modify the code to suit your needs...
Thank you very mush, I did a search on JSON but couldn't find anything to help in identify what I need perhaps I should have been more specific in my search, thanks again, it's a lot better than my fudged attempt