• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

need help building a =hiearchical= JSON object

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings all,

I've got a servlet with a query that builds a resultset sorted on three fields
-year-program-course-

I'd like to use the org.json classes to build up a hiearchical JSON object that, when used as a datastore for a Dojo Tree widget, makes a pretty Tree. You can see
some examples where I've hard-coded the JSON objects on this page:

http://edawizardry.com/testtree_2.jsp

I'm having some trouble setting/resetting the JSON objects within my while-loop.

What I've got so far...


Surely somewhere in the space-time continuum someone has done this kind of thing before?

As always, all comments/suggestions/constructive criticism/and especially examples are always appreciated.

TIA,

Still-learning Stuart




 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ooops, make that

http://edawizardry.com/testtree_2.jsp
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those appear to be the same link.

It's not clear what the issue is: what is happening that shouldn't be, or vice-versa?
 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> It's not clear what the issue is: what is happening that shouldn't be, or vice-versa?

Six hours later I'm not sure this could ever be made to work - JSONObject inherits java.util.HashMap and a consequence of this is
a JSONObject is an UNORDERED set of name-value pairs. But for the hiearchical JSON object to be usable as a Dojo datastore it
must have certain name-value pairs appear in a specific order.

So unless someone has a neat trick up their sleeve it's back to string-building -- yuck.


Now what?


Still-stumped Stuart
 
no wonder he is so sad, he hasn't seen this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!