• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help building a =hiearchical= JSON object

 
Stuart Rogers
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
 
David Newton
Author
Rancher
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic