aspose file tools*
The moose likes Other Open Source Projects and the fly likes need help building a =hiearchical= JSON object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "need help building a =hiearchical= JSON object" Watch "need help building a =hiearchical= JSON object" New topic
Author

need help building a =hiearchical= JSON object

Stuart Rogers
Ranch Hand

Joined: Oct 02, 2008
Posts: 140
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

Joined: Oct 02, 2008
Posts: 140
Ooops, make that

http://edawizardry.com/testtree_2.jsp
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Oct 02, 2008
Posts: 140
> 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help building a =hiearchical= JSON object