This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Im using struts2. I would like to know which api is the best to convert a java object to json object.
In action class i need to create a java object and send it to the browser.
in the browser using java script i want to access the java object as a json object and do further things.
Please let me know if any one is having solution.
Why not use the JSON Plugin that comes bundled with struts2? There is no work involved other than adding the jar to your lib and defining a result type with the JSONResult class and in your action you just reference that result type.
Joined: Sep 15, 2010
I am not sure about below item. Please let me know if I am wrong
1. If we use type='json' in result then all our class variables will be exposed in a json format to browser. Which I do not want.