Hi
I am retrieving a JSON response for a menu (via NewtonSoft) and am successfully parsing it for use.
The problem is that the end data I need could be 3 levels down or could be 7 levels down. How do I efficiently go about drilling down until I reach the final node?
The main issue is that I have no way to know at what point the path will end so I cannot just drill down 5 levels each time - every single path can have different number of levels.
So each bit of data could either be the end node or it could contain another set of nodes.
I need an efficient way to do the following sort of thing so I can build the menu tree.
Hope that makes some sort of sense! Many thanks!
I am retrieving a JSON response for a menu (via NewtonSoft) and am successfully parsing it for use.
The problem is that the end data I need could be 3 levels down or could be 7 levels down. How do I efficiently go about drilling down until I reach the final node?
The main issue is that I have no way to know at what point the path will end so I cannot just drill down 5 levels each time - every single path can have different number of levels.
So each bit of data could either be the end node or it could contain another set of nodes.
I need an efficient way to do the following sort of thing so I can build the menu tree.
Code:
For Each result As myresult In jsonresp.data
If result.hasnodes Is Nothing Then
' store the data and exit
Else
' repeat process on all nodes on next level
End If
Next
Comment