Hi all,
I got a JSON object from a request as Map using JSONParser
Imagine something like the code above. This works, now I can iterate over thirdList and take the values I want, but, I haev to check each item if exists to make sure I can go and have values in the last step. There is a short way, to go directly to thirdList and check if exists?
Something like
I tried the code above but my program just crashes, It stops on a breakpoint I put after "Dim" line, and program stops without any error.
I got a JSON object from a request as Map using JSONParser
B4X:
Dim response As Map = jp.NextObject
Dim firstList As Map = response.Get("firstList")
Dim secondList As Map = firstList.Get("ListInsideFirstList")
Dim thirdList As Map = secondList.Get("ListInsideSecondList")
Imagine something like the code above. This works, now I can iterate over thirdList and take the values I want, but, I haev to check each item if exists to make sure I can go and have values in the last step. There is a short way, to go directly to thirdList and check if exists?
Something like
B4X:
Dim response As Map = jp.NextObject
Dim theListIwant As Map = response.Get("firstList").As(Map).Get("ListInsideFirstList").As(Map).Get("ListInsideSecondList")
if (theListIwant.IsInitialized) <---- then the tree can be done and there is a path to ListInsideSecondList with values
I tried the code above but my program just crashes, It stops on a breakpoint I put after "Dim" line, and program stops without any error.