• 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

JQuery Tree via Ajax from JsonFormated Query

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i dont know if is the right section to place this subject

here you my problem :

What i have
a Pojo Category Class like this



Example in Database


Goal:
-Show List of Category with their Subcategory as Tree using a jquery plugin called fancytree FancyTree

Main Problem
-The format required on the jquery plugin come as json formatted like that



documentation Wiki

as it's my first experience using Json i dont know how to format the query to meet that

Thank you
 
Marshal
Posts: 67286
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the problem is that you don't know how to generate JSON on the server? Are you using a server-side JSON library such as Gson or Jackson?
 
Ivan Krasic
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:So the problem is that you don't know how to generate JSON on the server? Are you using a server-side JSON library such as Gson or Jackson?



Yes never used Json before (first time i use it) , the problem i use it is that all the jquery plugin like jstree , jqxtree wait result as json format

but in my Dao i return a list with all CategorieID , CatName and ParentID

i have the list now : what next ? how to transform it to json (as the json format change from plugin to others)

-i have no clue should be transformed from the list
-or need to be done in query dao side

Thanks
 
Bear Bibeault
Marshal
Posts: 67286
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The libraries I mentioned are designed to help you create JSON. I'd explore them, or any other JSON library you may want to use.
 
Ivan Krasic
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The libraries I mentioned are designed to help you create JSON. I'd explore them, or any other JSON library you may want to use.



i already got the google json library but not's that my main problem

how i will format my dao list which all category to this format ?



title= nomCategorie
key = categorieID

if category got subcategory then add folder = true , list of children...

and so on



hope you understand me ?
 
Ivan Krasic
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The libraries I mentioned are designed to help you create JSON. I'd explore them, or any other JSON library you may want to use.



Thanks Bear

i started reading json first then switched over playing with it a bit in basic java project

after that i add gson-2.2.4 to my current project and with little patience and brain i solved the issue alone

now i can implement any plugin with any json format on java

and i found it good to understand now how json/gson work as will need it on mobile part

Thank you
 
And inside of my fortune cookie was 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!