473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Drill down unknown levels JSON response

116 64KB
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.

Expand|Select|Wrap|Line Numbers
  1. For Each result As myresult In jsonresp.data
  2.     If result.hasnodes Is Nothing Then
  3.         ' store the data and exit
  4.     Else
  5.         ' repeat process on all nodes on next level
  6.     End If
  7. Next
  8.  
Hope that makes some sort of sense! Many thanks!
Oct 11 '14 #1

✓ answered by iam_clint

Put a while loop inside your for loop.
pseudo
Expand|Select|Wrap|Line Numbers
  1.  For Each result As myresult In jsonresp.data
  2. tmp=result
  3. while tmp.hasnodes
  4.  tmp=nextnode
  5. end while
  6. Next
  7.  
  8.  

2 1157
iam_clint
1,208 Expert 1GB
Put a while loop inside your for loop.
pseudo
Expand|Select|Wrap|Line Numbers
  1.  For Each result As myresult In jsonresp.data
  2. tmp=result
  3. while tmp.hasnodes
  4.  tmp=nextnode
  5. end while
  6. Next
  7.  
  8.  
Oct 12 '14 #2
robertybob
116 64KB
thx clint - will give this a go
Oct 13 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: deepakp | last post by:
Hello, I need to display a summary report as an table, giving the user ability to drilldown on a selected row by clicking on a '+' icon. After viewing drilldown of a particular row, user should...
0
by: jpeters | last post by:
I am trying to create a crystal report in c# dotnet environment that allows the user to drill down. I have divided the report into groups and made them drillable. So for example the user can...
2
by: mrwoopey | last post by:
Hi, I need to be able to click onto a map and then drill down to a report. For example, could we have a map of the Chicagoland area with clickable areas (zip code) and when a user clicks on an...
2
by: Mark | last post by:
Any suggestions or documentation links on how to recreate the look and feel of the MSDN website with the drill down menus on the left? We have some intranet applications that we can restrict to...
0
by: jtwright | last post by:
I'm trying to create an ASP.NET page that will read over my active directory tree and show the top level OrganizationalUnit values. From there I want the user to be able to click on the top level...
0
by: adamz5 | last post by:
I am currently exporting a crystal report using code. This works fine and exports the report to a word document onto disk using DiskFileDestinationOptions() and ExportOptions However when i...
3
by: Naseem | last post by:
I am using CR in ASP.NET , I am able to show drill down graphs where grouping is done on single column from result set of sql query, is it possible to achieve drill down by grouping on multiple...
4
by: Amuthaangler | last post by:
Hi all, I am currently working with Iframe which holds the JSON response from the server once when the picture gets uploaded successfully. Now I need to parse the JSON response and retrieve...
1
by: Mel | last post by:
Can anyone provide any help on how I would create a drill down on a web page? I want to create something like when you search for car parts the user can navigate the drill downs and at the top of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.